forked from bruno-barros/w.eloquent
-
Notifications
You must be signed in to change notification settings - Fork 0
4.09. Global JS
ArachnidsGrip edited this page Apr 15, 2019
·
1 revision
The GlobalJs class append a JSON object to the header.
<script id="weloquent_globaljs" type="text/javascript">
//<![CDATA[
var GJS = {...}
//]]>
</script>
It is accessible via GlobalJs
facade.
GlobalJs::add($index, $data = null [, $toAdmin = false]);
GlobalJs::remove($index);
GlobalJs::update($index, $data = null [, $toAdmin = false]);
GlobalJs::add('foo', 'value 1');
GlobalJs::add('bar.baz', 'value 2', true); // admin only
# now you can access via JavaScript
GJS.foo // value 1
GJS.bar.baz // value 2