From 4b554fea4b9ec575188c2631ac9a4d973e1a62c5 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 18 Sep 2024 17:46:50 -0400 Subject: [PATCH] testing basic web workers in production --- script/netlify_build.sh | 3 +++ test/worker.js | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/worker.js diff --git a/script/netlify_build.sh b/script/netlify_build.sh index fb2554fc32..10ed1c000e 100755 --- a/script/netlify_build.sh +++ b/script/netlify_build.sh @@ -5,5 +5,8 @@ set -euxo pipefail echo "Run build script (TODO: Make strict)" yarn run build2 +echo "Copy test files into dist" +cp -r test/* dist/ + echo "List files after build" find dist/ diff --git a/test/worker.js b/test/worker.js new file mode 100644 index 0000000000..fb3403d534 --- /dev/null +++ b/test/worker.js @@ -0,0 +1,9 @@ +onconnect = function (event) { + const port = event.ports[0]; + + port.onmessage = function (e) { + const workerResult = `Result: ${e.data[0] * e.data[1]}`; + port.postMessage(workerResult); + }; +}; +