This page describes the omniscope.view
API. A full index of the methods and events is listed below:
Fires a busy notification event to the framework to let it know that the view is currently busy depending on the parameter to the function.
Parameters:
boolean
Can be either true or false
Typically you would call this before any rendering or queries are executed and when everything has been rendered and displayed.
Returns the endpoint for executing Query API calls for the view.
Fires an error message to the framework to notify of an error that has occurred. Expects two parameters to be passed to the function.
Parameters:
message (String)
This is the error message description which is displayed to the end user.
internal (Object)
This is an arbitrary object which describes the problem, but it is not displayed to the user itself.
Used typically to report errors/bugs.
Returns the current context associated with the view which contains both data and option configuration for the view.
For more information see ViewApiContext.
Removes a listener to the appropriate events passed in as a parameter.
Parameters:
events
This can be either a single string or an array of events to remove.
function
The listener function to remove.
For example, omniscope.view.off(["load", "resize"], callMe)
or
omniscope.view.off("resize", callMe)
. This will result in the view
no longer listening to these events.
Adds a listener to the view to listen to events passed in as a parameter.
Parameters:
events
This can be either a single string or an array of events to listen.
function
The function to call when the events you are listening to occur.
For example, omniscope.view.on(["load", "resize"], callMe)
or
omniscope.view.on("resize", callMe)
Adds a one time listener to the view to listen to events passed in as a parameter.
Parameters:
events
This can be either a single string or an array of events to listen.
function
The function to call when the events you are listening to occur.
This is typically used to listen to one time events for example “load” event.
Fires context updated event to the framework.
This typically used when you modify the context object and want to notify the framework of the change so that it is handled appropriately.
For example, when you modify the viewSelection
property of the context and want to notify of the selection.
Fires whitespace click event to the application, when the user has clicked on dead space not occupied by a clickable visual element.
This is typically used to clear a selection or close menus.
The load event. This event is fired once the view has been loaded.
The event.data
is the initial ViewApiContext object.
Note there is no equivalent ‘unload’ or ‘dispose’ event. A view is implicitly disposed when its IFRAME element is destroyed.
The resize event. This event is fired when the browser or the element containing the view has been resized. For example, when you resize the browser.
The update event. This event is fired every time the context has been changed.
The event.data
is the updated ViewApiContext object.
The action event. This event is fired for option which has been configured as action type.
The event.data
would be the internal key mentioned in the manifest.json.
For example, in the case below the event.data
will be myAction
...
"options": {
"items": {
"myAction": {
"type": "ACTION",
"displayName": "My action",
"detail": "This is my action",
"fontIcon": "fa fa-refresh"
}
},
...