Waiting for the FacePop SDK to initialize

Fatos Bediu
Founder & Developer answerly.io
It might take a few milliseconds for the FacePop to load on your website and initialize the SDK fully.
Since this is the case, accessing the SDK directly on your website will throw errors since your code might run before the SDK has been initialized.
Fortunately, FacePop emits an event FacePop:Loaded
to the main window, which you should listen to and only use the SDK after that event has been fired.
For example:
window.addEventListener('FacePop:Loaded', () => {
// SDK is available here
// example code
Answerly.FacePop.play();
});
Did we answer your question?
😃 🤔 ☹️
How can we improve this answer?