Skip to content

Commit

Permalink
fix swup getting stuck by errors inside of handlers defined with on m…
Browse files Browse the repository at this point in the history
…ethod
  • Loading branch information
gmrchk committed Dec 16, 2018
1 parent 887e569 commit 0008882
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion dist/swup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,11 @@ module.exports = function (eventName, originalEvent) {

// call saved handlers with "on" method and pass originalEvent object if available
this._handlers[eventName].forEach(function (handler) {
return handler(originalEvent);
try {
handler(originalEvent);
} catch (error) {
console.error(error);
}
});

// trigger event on document with prefix "swup:"
Expand Down
Loading

0 comments on commit 0008882

Please sign in to comment.