We've introduced two new callback functions that you can define in the fs.js config:
- setOnScriptReadyFunction (Which is called when the script has loaded and is ready to run)
- setRequestTimerFunction (Which is called when the backend request to get a phone number has been sent to Kaisa, to measure how long time the request took)
Below a full example that uses the two new and one existing callback.
<script type="text/javascript">
function scriptIsReady() {
console.log('fs.js is ready');
}
function backendRequestTimer(start, end) {
console.log('Backend request took: ' + (end - start));
}
function numberReplaced(element, number, replacedWith) {
console.log(number + " was replaced with " + replacedWith + " in element " +
element);
}
var __fs_conf = __fs_conf || [];
__fs_conf.push(['setAdv',{'id': '<xyz>}]);
__fs_conf.push(['setOnScriptReadyFunction', scriptIsReady]);
__fs_conf.push(['setRequestTimerFunction', backendRequestTimer]);
__fs_conf.push(['addNumberReplacedListener', numberReplaced]);
</script>
<script type="text/javascript" src="js/fs.js"></script>
Comments
0 comments
Please sign in to leave a comment.