Skip to content

Instantly share code, notes, and snippets.

View abhishekgpta's full-sized avatar
🗯️
think before code

Abhishek gupta abhishekgpta

🗯️
think before code
View GitHub Profile
@abhishekgpta
abhishekgpta / eventemitter.js
Created August 23, 2020 17:24 — forked from mudge/eventemitter.js
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;