aboutsummaryrefslogtreecommitdiff
path: root/web/http
diff options
context:
space:
mode:
Diffstat (limited to 'web/http')
-rwxr-xr-xweb/http/start-server.sh8
-rw-r--r--web/http/worker.mjs14
2 files changed, 16 insertions, 6 deletions
diff --git a/web/http/start-server.sh b/web/http/start-server.sh
new file mode 100755
index 0000000..c827146
--- /dev/null
+++ b/web/http/start-server.sh
@@ -0,0 +1,8 @@
1#!/bin/sh
2
3# Run this script from the main folder (../../)
4
5darkhttpd web/http \
6 --header 'Cross-Origin-Opener-Policy: same-origin' \
7 --header 'Cross-Origin-Embedder-Policy: require-corp' \
8 --mimetypes web/http/mime
diff --git a/web/http/worker.mjs b/web/http/worker.mjs
index d912e8b..0c1acb9 100644
--- a/web/http/worker.mjs
+++ b/web/http/worker.mjs
@@ -1,14 +1,16 @@
1import Nissy from "./nissy_web_module.mjs" 1import Nissy from "./nissy_web_module.mjs"
2 2
3const nissy = await Nissy(); 3const nissy = await Nissy();
4const log = (msg) => postMessage({ command: "log", id: -1, object: msg });
5nissy.setLogger(nissy._addCallbackFunction(log));
6 4
7var solveStatus = nissy.statusRUN; // For now this is a global variable 5const log = (cstr) => postMessage({
8const pollStatusCallback = nissy._addCallbackFunction(() => { 6 command: "log", id: -1,
9console.log("Calling pollstatus, returning " + solveStatus); 7 object: nissy.UTF8ToString(cstr)
10return solveStatus;
11}); 8});
9nissy.setLogger(nissy.addFunction(log, "vp"));
10
11var solveStatus = nissy.statusRUN; // For now this is a global variable
12const pollStatus = () => solveStatus;
13const pollStatusCallback = nissy.addFunction(pollStatus, "i");
12 14
13const commands = [ 15const commands = [
14 { name: "load solver data", exec: loadSolverDataFromStorage }, 16 { name: "load solver data", exec: loadSolverDataFromStorage },

Generated with cgit - Back to sebastiano.tronto.net