Mercurial > hg > orthanc-stone
diff Platforms/Wasm/default-library.js @ 603:70992b38aa8a
new routable logging system in STDIO mode + flag support (with no value) in StartupParametersBuilder + 80 col indent
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 29 Apr 2019 15:09:48 +0200 |
parents | 7105a0bad250 |
children |
line wrap: on
line diff
--- a/Platforms/Wasm/default-library.js Mon Apr 29 14:40:01 2019 +0200 +++ b/Platforms/Wasm/default-library.js Mon Apr 29 15:09:48 2019 +0200 @@ -1,21 +1,49 @@ // this file contains the JS method you want to expose to C++ code mergeInto(LibraryManager.library, { + ScheduleWebViewportRedrawFromCpp: function(cppViewportHandle) { window.ScheduleWebViewportRedraw(cppViewportHandle); }, + CreateWasmViewportFromCpp: function(htmlCanvasId) { return window.CreateWasmViewport(htmlCanvasId); }, + // each time the StoneApplication updates its status, it may signal it // through this method. i.e, to change the status of a button in the web interface UpdateStoneApplicationStatusFromCppWithString: function(statusUpdateMessage) { var statusUpdateMessage_ = UTF8ToString(statusUpdateMessage); window.UpdateWebApplicationWithString(statusUpdateMessage_); }, + // same, but with a serialized message UpdateStoneApplicationStatusFromCppWithSerializedMessage: function(statusUpdateMessage) { var statusUpdateMessage_ = UTF8ToString(statusUpdateMessage); window.UpdateWebApplicationWithSerializedMessage(statusUpdateMessage_); + }, + + // These functions are called from C++ (through an extern declaration) + // and call the standard logger that, here, routes to the console. + + stone_console_error : function(message) { + var text = UTF8ToString(message); + window.errorFromCpp(text); + }, + + stone_console_warning : function(message) { + var text = UTF8ToString(message); + window.warningFromCpp(text); + }, + + stone_console_info: function(message) { + var text = UTF8ToString(message); + window.infoFromCpp(text); + }, + + stone_console_trace : function(message) { + var text = UTF8ToString(message); + window.debugFromCpp(text); } + });