diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-27 16:45:06 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-27 16:45:06 +0200 |
| commit | cf2896324e60e2dc3890c658378499383100e79c (patch) | |
| tree | ad81c2dd806f561857824c5f1d34b80f8e20f86b /web/http/worker.mjs | |
| parent | 7c934801f88c640970ad41b5ddd39f4e39609f28 (diff) | |
| download | nissy-core-cf2896324e60e2dc3890c658378499383100e79c.tar.gz nissy-core-cf2896324e60e2dc3890c658378499383100e79c.zip | |
Big progress with web version
Diffstat (limited to 'web/http/worker.mjs')
| -rw-r--r-- | web/http/worker.mjs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/web/http/worker.mjs b/web/http/worker.mjs deleted file mode 100644 index 7ce1070..0000000 --- a/web/http/worker.mjs +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | import Nissy from "./nissy_web_module.mjs" | ||
| 2 | |||
| 3 | const nissy = await Nissy(); | ||
| 4 | nissy.setLogger(nissy._addCallbackFunction(console.log)); | ||
| 5 | |||
| 6 | onmessage = (e) => { | ||
| 7 | //TODO: try to load from storage first, then download | ||
| 8 | nissy.initSolverDownload(e.data.solver, "/tables").then( | ||
| 9 | (download_result) => { | ||
| 10 | if (!download_result) { | ||
| 11 | postMessage("Error retrieving the solver data"); | ||
| 12 | } else { | ||
| 13 | var cube = new nissy.Cube(); | ||
| 14 | cube.move(e.data.scramble); | ||
| 15 | |||
| 16 | nissy.solve(e.data.solver, cube, nissy.NissFlag.normal, | ||
| 17 | 0, 17, 1, 99, 4, -1).then( | ||
| 18 | (solve_result) => { | ||
| 19 | if (!solve_result.err.ok()) | ||
| 20 | postMessage("Error while solving (solve returned " + | ||
| 21 | solve_result.err.value + ")"); | ||
| 22 | else | ||
| 23 | postMessage(solve_result.solutions) | ||
| 24 | }); | ||
| 25 | } | ||
| 26 | }); | ||
| 27 | }; | ||
