The In-Client JavaScript API provides programmatic access to Desktop Client features. Use this API to build custom web-based integrations and widgets that run directly inside the Nx Witness Desktop Client.
Global objects
The client automatically injects the following global objects into the JavaScript environment:
vms: Manages global constants and methods.vms.log: Logs messages through the standard VMS logging system.vms.resources: Manages system resources.vms.tabs: Manages multiple client tabs.vms.tab: Manages the currently open tab.vms.self: Controls the active web-page widget.vms.auth: Retrieves authentication data.
Initialize the API
Global objects are unavailable until the initialization callback executes. To initialize the API, define the window.vmsApiInit function:
<script>
window.vmsApiInit = async function() {
vms.log.info("API initialized successfully.");
}
</script>Handle events with signals
Use signals to listen for client-side events. To attach an event handler, pass your callback function to the signal's connect() method:
vms.resources.added.connect(function(resource) {
vms.log.info(`Added new resource: ${resource.name}`);
});Access complete documentation
Each object operates as an independent module with its own methods and properties.
To view the complete API documentation inside the Nx Witness Desktop Client:
Drag any integration into the Main Window.
Right-click the integration.
Select JavaScript API.
Comments
0 comments
Article is closed for comments.