Is there built-in on call function event in JavaScript / jQuery ?
I mean something on('call' , function(){})
I use this custom event meanwhile:
function setCookie(name, value, days) {
// set ...
$(document).trigger( "setCookieEvent", [ name ] );
}
function cookieController()
{
$(document).on( "setCookieEvent", function( event, name ) {
//setCookie name
});
}
cookieController();
setCookie, you could cache the function and then replace it with one that invokes your new function as well as the cached one. But if you needed to do this with various handlers that need to be bound and unbound, you'd need to create your own mini event system, which isn't too hard.