Question

If I have got:

blockRoutes = function (value) {
        $('body').trigger('cantLeaveRoute', { val: value });
        return value;
}

Except in binding callback like:

this.bind('cantLeaveRoute', function () {
        this.params['val'] === true ? nav.disableHeader() : nav.enableHeader()            
 });

How can I DIRECTLY (without the bind shown above) read the current value of the param?

Something along the lines of the wrong syntax below:

$('body').data('events')['cantLeaveRoute'].val 
Was it helpful?

Solution

The parameters you set in trigger are part of the event

this.bind('cantLeaveRoute', function (event) {
 var value = event.data.val;
 value === true ? nav.disableHeader() : nav.enableHeader()            
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top