See also 📢 Dead simple tweetable JavaScript Emitter pattern module using Map (ES2015) which uses this package.
Browser compatibility (all)
| Chrome* | Edge | FF | IE | Opera | Safari | iOS |
|---|---|---|---|---|---|---|
| 38 | 12 | 13 | -* | 25 | 7.1 | 8 |
Notes:
- Chrome includes mobile Chrome.
- IE 11 does not support only arrow functions, they can be replaced with
function. Also, incomplete Set support means the hand-minified version does not work.
I added a minified/uglified version which fits in a tweet!
Also note that
module.exports=is the exact same length asexport default(16 characters). So you can easily use it in node.js (>=v0.12) without transpiling.What I used / found out:
Object.freeze.{s.add(f);return _=>s.delete(f)}tos.add(f).delete.bind(s,f). AsSet.prototype.add()returns the Set object we can then access theSet.prototype.delete()._=>is one character less than()=>and works the same! Of course, any letter would do, too.constis 5 letters,varandletjust 3. If it works withconstit will work withvarandlet.