You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Couldn't find a clean way to do it so my approach is to pass in a third variable ( array or pointer ) then modify eve.once to assign f2 to that variable, so i can unsub with eve.off("evt", f2).
eve.once = function (name, f, unbinder) {
var f2 = function () {
eve.unbind(name, f2);
return f.apply(this, arguments);
};
if(unbinder) unbinder.push(f2);
return eve.on(name, f2);
};
It's absolutely ugly but does the job for now. Does anyone have a cleaner way to implement ?
The text was updated successfully, but these errors were encountered:
Couldn't find a clean way to do it so my approach is to pass in a third variable ( array or pointer ) then modify eve.once to assign f2 to that variable, so i can unsub with eve.off("evt", f2).
eve.once = function (name, f, unbinder) {
var f2 = function () {
eve.unbind(name, f2);
return f.apply(this, arguments);
};
if(unbinder) unbinder.push(f2);
return eve.on(name, f2);
};
It's absolutely ugly but does the job for now. Does anyone have a cleaner way to implement ?
The text was updated successfully, but these errors were encountered: