The context of a message sent to a user script More...
Import Statement: | import com.canonical.Oxide 1.15 |
Instantiates: | OxideQQuickScriptMessageRequest |
ScriptMessageRequest represents the context of a message sent to a user script. The application can provide reply and error callbacks by setting the onreply and onerror callbacks accordingly.
The error callback. This will be invoked with 2 arguments in the event of an error occuring with the message that the application sent.
The first argument will be an error code, with the following possible values:
Constant | Description |
---|---|
ScriptMessageRequest.ErrorInvalidContext | The frame that the message was sent to does not have a JS context with the specified ID. |
ScriptMessageRequest.ErrorUncaughtException | The message handler provided by the user script threw an exception. Details of the exception will be provided in the second argument. |
ScriptMessageRequest.ErrorNoHandler | There was no handler for the message. |
ScriptMessageRequest.ErrorHandlerReportedError | Use of this is discouraged now. |
ScriptMessageRequest.ErrorHandlerDidNotRespond | The message was successfully delivered to a handler provided by the user script, but it failed to respond. |
The reply callback. This will be invoked with a single argument (the message payload, which is application defined) when the user script replies to the message that the application sent it.