Skip to content

Instantly share code, notes, and snippets.

@aduth
Created March 18, 2019 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aduth/f464f2d549a80716127a7e0d575b102f to your computer and use it in GitHub Desktop.
Save aduth/f464f2d549a80716127a7e0d575b102f to your computer and use it in GitHub Desktop.
function globalListener() {
const errors = listeners.reduce( ( result, listener ) => {
try {
listener();
} catch ( error ) {
result.push( error );
}
return result;
}, [] );
errors.forEach( ( error ) => {
throw error;
} );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment