Events module is a great thing if you want to develop pure event driven application. Usage is simple. Like in well known jQuery you can subscribe to some event. There is one global events object accessible via br.events
. You can create own events object by var events = br.eventQueue();
<script> br.events.on('someEvent', function(someData) { alert('someEvent triggered'); }); $('body').click(function() { br.events.trigger('someEvent', someData); }); </script>
Method/property | Description |
---|---|
If you are using global config, please prepend below methods with br.events. |
|
on(name, callback) | Register event callback |
trigger(name, ...data...) | Trigger event |
stick(name, ...data...) | Trigger sticky event |