0032315: Configuration, CMake - fix building Draw Harness plugins as static libraries
[occt.git] / src / DRAWEXE / DRAWEXE.html
diff --git a/src/DRAWEXE/DRAWEXE.html b/src/DRAWEXE/DRAWEXE.html
new file mode 100644 (file)
index 0000000..4147bf1
--- /dev/null
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html lang=en-us>
+<head>
+<meta charset=utf-8><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
+<link rel="shortcut icon" href="lamp.ico" type="image/x-icon" />
+<title>OCCT Draw Harness</title>
+</head>
+<body>
+
+<h2>OCCT Draw Harness</h2>
+<div>
+  <canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
+</div>
+<h4>Output (open JavaScript console):</h4>
+<p id="output"></p>
+<script type="text/javascript" src="DRAWEXE.js" charset="utf-8"></script>
+<script>
+//! Check browser support.
+function isWasmSupported()
+{
+  try {
+    if (typeof WebAssembly === "object"
+     && typeof WebAssembly.instantiate === "function") {
+      const aDummyModule = new WebAssembly.Module (Uint8Array.of (0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
+      if (aDummyModule instanceof WebAssembly.Module)
+      {
+        return new WebAssembly.Instance(aDummyModule) instanceof WebAssembly.Instance;
+      }
+    }
+  } catch (e) {}
+  return false;
+}
+if (!isWasmSupported())
+{
+  var anElement = document.getElementById('output');
+  anElement.innerHTML += "Browser is too old - WebAssembly support is missing!<br>Please check updates or install a modern browser.<br>";
+}
+
+var DRAWEXE =
+{
+  print: (function() {
+    var anElement = document.getElementById('output');
+    //return function(theText) { anElement.innerHTML += theText + "<br>"; };
+    return function(theText) { console.warn(theText); };
+  })(),
+  printErr: function(theText) {
+    //var anElement = document.getElementById('output');
+    //anElement.innerHTML += theText + "<br>";
+    console.warn(theText);
+  },
+  canvas: (function() {
+    var aCanvas = document.getElementById('occViewerCanvas');
+    return aCanvas;
+  })(),
+
+  onRuntimeInitialized: function() {
+    //
+  }
+};
+
+const DRAWEXEInitialized = createDRAWEXE(DRAWEXE);
+DRAWEXEInitialized.then(function(Module) {
+  //DRAWEXE.eval("dversion");
+});
+
+</script>
+</body>
+</html>