Skip to main content

Async/Await callbacks

Intro.js main functions to start/stop a tour return a Promise object. You can also return a Promise object in the callback functions (e.g. onbeforechange) and Intro.js internally waits for that Promise object to be fulfilled. You can use this concept to perform async I/O (e.g. sending HTTP calls) before moving to the next step of the tour.

In the following example, we are returning a Promise object and we resolve it after 500ms:

Live Editor
Result
Loading...

Image alt text
The Quaco Head Lighthouse is a well maintained lighthouse close to St. Martins. It is a short, beautiful walk to the lighthouse along the seashore.