Skip to content

Commit

Permalink
Fix: Prevent preview from erroring if listener callback errors (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press authored Oct 17, 2017
1 parent 87a3278 commit ed0efb8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,16 @@ class Preview extends EventEmitter {
}
}

emit(eventName, data) {
try {
super.emit(eventName, data);
} catch (e) {
/* eslint-disable no-console */
console.error(e);
/* eslint-enable no-console */
}
}

/**
* Finish loading a viewer - display the appropriate control buttons, re-emit the 'load' event, log
* the preview, and prefetch the next few files.
Expand Down

0 comments on commit ed0efb8

Please sign in to comment.