Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sanjayabc1234/ccfe71451ad11a14b65e8014afb257d4 to your computer and use it in GitHub Desktop.
Save sanjayabc1234/ccfe71451ad11a14b65e8014afb257d4 to your computer and use it in GitHub Desktop.
removeListener(name, listenerToRemove) {
if (!this._events[name]) {
throw new Error(`Can't remove a listener. Event "${name}" doesn't exits.`);
}
const filterListeners = (listener) => listener !== listenerToRemove;
this._events[name] = this._events[name].filter(filterListeners);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment