Mercurial > hg > orthanc-stone
diff Resources/Graveyard/Deprecated/Platforms/Wasm/default-library.js @ 1503:553084468225
moving /Deprecated/ to /Resources/Graveyard/Deprecated/
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Jun 2020 11:38:13 +0200 |
parents | Deprecated/Platforms/Wasm/default-library.js@419d0320c344 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Graveyard/Deprecated/Platforms/Wasm/default-library.js Tue Jun 30 11:38:13 2020 +0200 @@ -0,0 +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); + } + +});