DiviAreaItem.addAction(hook, callback, priority, context)

Register a new hook that only listens to actions of this Area. Use DiviAreaItem.doAction() to trigger an Area action.

See DiviArea.addAction() function for more details on how actions work.


hook string, required
The hook name, without an area-suffix.
callback function, required
The callback function to execute when the action is fired. Any return value of the callback function is ignored.
priority int, optional
Used to specify the order, in which callbacks are executed. Callbacks with a lower priority are called first.
Default: 10
context object, optional
Used to define a custom value for the scope-variable this in the callback function.
Default: <code>window</code>


The function does not return anything.


var area = DiviArea.getArea();
area.addAction('show_area', function(hookArea) {
console.log('Area is now visible:', hookArea.theId());


No notes

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Get in touch with us