Skip to content

Instantly share code, notes, and snippets.

@Yamo93
Created October 31, 2020 21:48
Show Gist options
  • Save Yamo93/5841d53a0dcb4fa75b6085fe6faaf73e to your computer and use it in GitHub Desktop.
Save Yamo93/5841d53a0dcb4fa75b6085fe6faaf73e to your computer and use it in GitHub Desktop.
Subscribe method
function subscribe(eventName, callback) {
if (!Array.isArray(subscribers[eventName])) {
subscribers[eventName] = [];
}
subscribers[eventName].push(callback);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment