Closed gokatz closed 6 years ago
Ah. I see what you're saying.
var e = new Eev();
function foo(data) {console.log("FOO");}
e.off('bar', foo);
That code blows up because foo
is not a registered event handler. I'm happy to take a pull request! Should be as simple as putting an if statement in there.
I'm unaware of the uglifyjs
version you are using to minify the changes. Can you mention that in the package.json
?
Yeah. I originally wrote this back before I really knew much about npm
! I'll put an update together. Also, I can just go ahead and fix the bug, unless you want to get credited with a pull request. Let me know!
Well, I went ahead and fixed both! But this has made me want to revisit this project and modernize it a bit. We'll see if I can set aside the time to do that.
Thanks!
Thanks for the update @chrisdavies and I would love to know if postMessage could be a good alternative.
That's an interesting idea! postMessage
is designed to solve a different problem from generic event emission (what Eev does). I think you could probably use postMessage
for the same purpose if you're programming in the browser. It wouldn't work on Node, though, which can make unit testing more of a pain.
by this line, we made the callback to
of
as mandatory which will not a case for many scenarios. Can we make this as optional? Happy to raise a PR. 😃