Method Summary
| getName ( ) → name |
Return the unique identifier of a secondary application. Use this information to discern which object to perform operations on. |
| getProperties ( ) → Array.<ToiApplicationService.ToiApplicationProperty> |
Returns the properties of the secondary application. |
| getState ( ) → state |
Returns the current state of the application. Valid return values are: ToiSecondaryApplication.STATE_STOPPED : The application is not running. ToiSecondaryApplication.STATE_LOADING : The application is loading and will be running shortly. ToiSecondaryApplication.STATE_VISIBLE : The application is running and visible. ToiSecondaryApplication.STATE_HIDDEN : The application is running but is hidden. |
| hasInputFocus ( ) → hasInputFocus |
This method returns whether the secondary application has input focus or not. |
|
hide
(
|
Makes the application attempt to enter the ToiSecondaryApplication.STATE_HIDDEN state. This is only possible if it is in the ToiSecondaryApplication.STATE_VISIBLE or ToiSecondaryApplication.STATE_HIDDEN states. The operation will be considered completed and successful when ToiSecondaryApplication.STATE_HIDDEN is reached and, if this is not possible, the operation will be considered as failed. |
| setInputFocus ( ) |
Makes the application receive user input. After this function is called, the primary application will only receive input events it has subscribed to. This is only possible if the application is in the ToiSecondaryApplication.STATE_VISIBLE state. |
|
setProperty
(
|
Set the value of an existing writable property. |
|
show
(
|
Makes the application attempt to enter the ToiSecondaryApplication.STATE_VISIBLE state. This is only possible if it is already in the ToiSecondaryApplication.STATE_HIDDEN or ToiSecondaryApplication.STATE_VISIBLE states. |
|
start
(
|
Makes the application attempt to enter the ToiSecondaryApplication.STATE_HIDDEN state via ToiSecondaryApplication.STATE_LOADING. This is not possible if it is already in the ToiSecondaryApplication.STATE_VISIBLE. |
|
stop
(
|
Makes the application enter the ToiSecondaryApplication.STATE_STOPPED state. This operation cannot fail. |
|
subscribeKey
(
|
Subscribe to key presses sent to this application. If the subscribed key is pressed while this application has input focus, the main UI will receive it as well. |
|
unsubscribeKey
(
|
Stop subscribing to key presses sent to this application. |
Inherited Methods
|
addEventListener
(
|
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners. |
|
removeEventListener
(
|
This method removes an event listener for a specific event. |
Type Definitions
|
The different states a secondary application can be in. |
|
Methods
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to subscribe to.
listenerToiEventListener The JavaScript function that will receive events.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice.
Return the unique identifier of a secondary application. Use this information to discern which object to perform operations on.
Returns:
-
Type: string
Return the name of the secondary application.
Returns the properties of the secondary application.
Returns:
-
Type: Array.<ToiApplicationService.ToiApplicationProperty>
The properties of the secondary application.
Returns the current state of the application. Valid return values are: ToiSecondaryApplication.STATE_STOPPED : The application is not running. ToiSecondaryApplication.STATE_LOADING : The application is loading and will be running shortly. ToiSecondaryApplication.STATE_VISIBLE : The application is running and visible. ToiSecondaryApplication.STATE_HIDDEN : The application is running but is hidden.
Returns:
-
Type: ToiSecondaryApplication.ToiState
The current state of the secondary application.
This method returns whether the secondary application has input focus or not.
Returns:
-
Type: boolean
Whether the secondary application has input focus.
Makes the application attempt to enter the ToiSecondaryApplication.STATE_HIDDEN state. This is only possible if it is in the ToiSecondaryApplication.STATE_VISIBLE or ToiSecondaryApplication.STATE_HIDDEN states. The operation will be considered completed and successful when ToiSecondaryApplication.STATE_HIDDEN is reached and, if this is not possible, the operation will be considered as failed.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
Throws:
-
ToiInvalidArgumentException Raised if the operationId is invalid.
ToiInvalidPreconditionException Raised if the application is not in ToiSecondaryApplication.STATE_VISIBLE or ToiSecondaryApplication.STATE_HIDDEN.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
This method removes an event listener for a specific event.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to remove the listener from.
listenerToiEventListener The JavaScript function that was previously added as an event listener.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener has not previously been added.
Makes the application receive user input. After this function is called, the primary application will only receive input events it has subscribed to. This is only possible if the application is in the ToiSecondaryApplication.STATE_VISIBLE state.
Throws:
-
ToiInvalidPreconditionException Raised if the application is not in ToiSecondaryApplication.STATE_VISIBLE.
Set the value of an existing writable property.
Parameters:
-
Name Type Description namestring Property name.
valuestring Property value.
Throws:
-
ToiInvalidArgumentException Raised if the property can't be set because it doesn't exist or is not writable.
Makes the application attempt to enter the ToiSecondaryApplication.STATE_VISIBLE state. This is only possible if it is already in the ToiSecondaryApplication.STATE_HIDDEN or ToiSecondaryApplication.STATE_VISIBLE states.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
Throws:
-
ToiInvalidArgumentException Raised if the operationId is invalid.
ToiInvalidPreconditionException Raised if the application is not in ToiSecondaryApplication.STATE_HIDDEN or ToiSecondaryApplication.STATE_VISIBLE.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Makes the application attempt to enter the ToiSecondaryApplication.STATE_HIDDEN state via ToiSecondaryApplication.STATE_LOADING. This is not possible if it is already in the ToiSecondaryApplication.STATE_VISIBLE.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
parameters
[optional]Array.<string> Parameters to pass to the application, such as the URL of a webpage. It is up to the application to define and document how it handles parameters.
Throws:
-
ToiInvalidArgumentException Raised if the operationId is invalid.
ToiInvalidPreconditionException Raised if the application is in STATE_VISIBLE.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Makes the application enter the ToiSecondaryApplication.STATE_STOPPED state. This operation cannot fail.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
Throws:
-
ToiInvalidArgumentException Raised if the operationId is invalid.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Subscribe to key presses sent to this application. If the subscribed key is pressed while this application has input focus, the main UI will receive it as well.
Parameters:
-
Name Type Description keystring The W3C key identifier of the key to subscribe to.
Throws:
-
ToiInvalidArgumentException Raised if the key is not a valid keyIdentifier.
Stop subscribing to key presses sent to this application.
Parameters:
-
Name Type Description keystring The W3C keyidentifier of the key to stop subscribing to.
Throws:
-
ToiInvalidArgumentException Raised if the key is not a valid keyIdentifier.
Members
This is an Event identifier for ToiSecondaryApplicationInputFocusChangedEvent.
This notification will be triggered when a secondary application has changed input focus.
This is an Event identifier for ToiSecondaryApplicationStartRequestedEvent.
This notification will be triggered when there is an external request to start the secondary application.
This is an Event identifier for ToiSecondaryApplicationStateChangedEvent.
This notification will be triggered when a secondary application has changed state.
This is an Event identifier for ToiSecondaryApplicationStopRequestedEvent.
This notification will be triggered when there is an external request to stop the secondary application.
In STATE_HIDDEN the application is running but not visible. When in this state, the application can not be displayed, but it may be performing background tasks. In general, it can be assumed that an application in STATE_HIDDEN is less demanding on system resources than when it is in STATE_VISIBLE. An application in this state can be made visible or stopped.
In STATE_LOADING the application is in its warmup phase. When in this state, the application can not be displayed or interacted with. The only allowed operation is to stop it. After some time, the application will transition to STATE_HIDDEN. This will be signalled to listeners who are subscribed to the application object with the ToiSecondaryApplicationStateChangedEvent event.
In STATE_STOPPED the application is not running. When in this state, the application can not be displayed or interacted with by the user. Functions that require an application to be running will fail with a ToiInvalidPreconditionException.
In STATE_VISIBLE, the application is running and is displaying graphics. When in this state, the application can be displayed below the main UI, which means it is up to the main UI to make itself transparent or invisible in order to make the secondary application appear. An application in this state can be made invisible or stopped.