EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
https://eragonj.github.io/Trip.js/
MIT License
793 stars 111 forks source link

Add onError callback to allow trip to report error to user #181

Closed 71FIL closed 6 years ago

71FIL commented 7 years ago

This is a proposed change for issue 170.

It adds the onError callback in the settings and is set to $.noop by default. If the callback returns anything that evaluates to true, trip will stop.

The new callback is called in three distinct cases:

The next() function was changed a little:

A draft for the documentation is also included but would certainly benefit from a review.

The skipUndefinedTrip behavior can remain as is (backward compatible) but could be removed in a future release as it can be replaced with a onError() handler returning false for an "invalid trip" message.

71FIL commented 7 years ago

This is related to issue #170.