All Collections
For Developers
Common questions
How to know when the UserGuiding script is loaded and the JavaScript API is ready?
How to know when the UserGuiding script is loaded and the JavaScript API is ready?
Met avatar
Written by Met
Updated over a week ago

There are a couple of ways to execute your functions when UserGuiding code is loaded. 

The first one is to push an  onload  event to userGuidingLayer as below. We'll execute this command when the UserGuiding application is loaded.

window.userGuidingLayer.push({
  event: 'onload',
  fn: _YOUR_FUNCTION_HERE_,
})


Another one is to set a variable called  onUserGuidingLoad  explicitly to the window.

window.onUserGuidingLoad = _YOUR_FUNCTION_HERE_
Did this answer your question?