Access API: API Availability
The custom JavaScript functions Kiosk Pro uses in its JavaScript API must be loaded before they can be called by your code. If you are accessing the JavaScript API by Import (as recommended), all functions will be loaded into the page prior to the ‘onload’ event and will be available at any time.
If you choose to access the JavaScript API by Injection, it may not be fully loaded when the ‘onload’ event is triggered. In this case, we recommend using these functions to determine when it is safe for your code to call an API function.
Functions
App-Defined Variables
Related Settings
Requirements
- Access JavaScript API
- By Injection - only works offline, may not be available 'onload' event.
Note: API Availability functions are not available when the JavaScript API is accessed by Import. If you are accessing API functions by Import, they will always be available when the window.onload event triggers, so these functions are not needed or triggered in that mode.
Sample Code
kp_Vars_DidInject
This is a callback triggered by the app when all app-defined variables in the JavaScript API have been successfully loaded and are available for use.
Format | kp_Vars_DidInject(callback); |
Parameters | callback = callback name as string |
Callback Format | callback(); |
This callback does not return a specific value, but instead can be used to trigger other events that rely on the JavaScript API being available. This is done by defining this callback function in your code and placing a call within it.
kp_Hooks_DidInject
This callback is triggered by the app when all functions and callbacks that make up the JavaScript API have been successfully loaded and are available for use.
Format | kp_Hooks_DidInject(callback); |
Parameters | callback = callback name as string |
Status | Returns no specific value, but can be used to trigger other events that rely on the JavaScript API being available by defining this callback function in your code and placing a call within it. |
window.kioskpro_hooks_available
This variable defines whether the full JavaScript API has been loaded successfully.
Format | window.kioskpro_hooks_available |
Possible Values |
|