I’m trying to remove some eventlistener like this:
var callback = function () {
someFun(someobj)
}
console.log(callback)
e.once("5", callback);
uponSomeOtherStuffHappening('',
function() {
console.log(e.listeners("5")[0])
e.removeListener(inTurns, callback)
})
But it doesn’t work.
The first console log shows:
[Function]
The second one shows:
[Function: g]
Why are they different?
The implementation of once() inserts a function g() to remove your listener after one call.
From events.js:
So, if you did this:
they’d be the same.