The back-office of Novius OS is one “big HTML page”. Actions performed in one tab can affect other tabs (ex: adding, modifying or deleting an item).
An event system has been established to enable the various interface elements to communicate with each other.
Dispatched events are executed immediately on the current active tab or popup (the one which has focus). For other tabs (or popups), they are executed only when the tab or popup becomes active / focused.
For the callback function to be triggered, listened and triggered events should not match exactly. The listened event can just match one property of the triggered event.
Arguments: |
|
---|
// Listen all events with name 'Nos\Model_Page'
$(domContext).nosListenEvent({
name: 'Nos\Model_Page'
}, function(event) {
// ...
}, 'caller');
// Listen all events with the 'Nos\Model_Page' name and 'insert' or 'delete' actions
$(domContext).nosListenEvent({
name: 'Nos\Model_Page',
action: ['insert', 'delete']
},
function(event) {
// ...
});
// Listen all events with the 'Nos\Model_Page' name and 'insert' or 'delete' actions,
// or events with the 'Nos\Model_Page' name and the 'main::en_GB' context
$(domContext).nosListenEvent([
{
name: 'Nos\Model_Page',
action: ['insert', 'delete']
},
{
name; 'Nos\Model_Page',
context; 'main::en_GB'
}
], function(event) {
// ...
});
Stop listening events for a specific caller. See caller param of nosListenEvent.
Arguments: |
|
---|
$(domContext).nosUnlistenEvent('caller');
Dispatches an event to all available dispatchers.
Arguments: |
|
---|
// Dispatch event, page with ID 4 has been create with 'main::en_GB' context
$.nosDispatchEvent({
name: 'Nos\Model_Page',
action: 'insert',
id: 4,
context: 'main::en_GB',
});