![]() ![]() |
GoFiler Legato Script Reference
Legato v 1.6e Application v 6.3a
|
| Table of Contents | < < Previous | Next >> |
Chapter Twenty-one — WebView Interface (continued)
JavaScriptSetMessageHandler Function
Overview
The JavaScriptSetMessageHandler function sets a Legato function as a message handler. This function will be executed whenever JavaScript within the WebView object posts a message.
Syntax/Parameters
Syntax
string = JavaScriptSetMessageHandler ( handle hWVO, string function );
Parameters
hWVO
A handle specifying a WebView Object.
function
A string specifying a Legato function name
Return Value
A string specifying the previous function name or an empty string on error. Note that this value value be empty under normal conditions. Use the IsError or GetLastError function to determine if an error occurred and the nature of the error.
Remarks
The specified Legato function will be called whenever JavaScript running within the WebView uses the window.chrome.webview.postMessage function. The callback should have the following definition
void handler (string json) {...}
The arguments passed from JavaScript are converted to a JSON string by the WebView. Certain objects may not translate well. The JSON string can be read as-is or using the Legato JSON parser. Because this function is a callback, the main Legato loop must be waiting for messages to be processed for the callback to occur. Developers should avoid calling additional JavaScript functions within the callback.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Page revised 2025-10-20
| Table of Contents | < < Previous | Next >> |
© 2012-2025 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission is prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. Novaworks, GoFiler™ and Legato™ are registered trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are the property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.