what if I have Object already with 'on' method?
Closed this issue · 6 comments
Like this, but subj. My router, for example has .on('/', function () {... })
Can I avoid pollution for some objects like this one?
you router works without problems, right?
unfortunately no, with eddy 'on' method was overrided
that's not possible because eddy does not override anything on Object level, it does on the prototype and it lazily override if not there yet.
EventEmitter
in nodejs is just an example that works as expected without problems on eddy
Can you show me the code you are using for your router?
example
require('eddy');
var EventEmitter = require('events').EventEmitter;
var e = new EventEmitter;
e.on !== Object.prototype.on; // true !!!
The only case you might have problems is when you require eddy
after any other module … being eddy an environment and not just a module you should include it as very first thing on your project and nothing will be affected.
Please let me know if that is not the case.
Best Regards
Argh, that's min.js, not eddy! Sorry! Thank you for fast answer, and for great minimalistic libraries & hacks! You man the best!
not sure what is min.js
exactly but glad you solved the problem.