Last active
June 18, 2018 20:31
-
-
Save leo60228/a49b32d03741dc5fa17f8375c7633b75 to your computer and use it in GitHub Desktop.
<0.3KB EventEmitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict";function EventEmitter(){var c=[];return{on:function(d,f){c.push({a:d,b:f})},emit:function(d){c.filter(function(f){return f.a==d}).forEach(function(f){return f.b()})},off:function(d){c.splice(c.indexOf(d),1)}}} |
Oh, so it's supposed to be ES5 only?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@cookiengineer - arrow functions are ES6.