Move to TypeScript (#3830)

This moves our JS file to use TS instead, which allows us to use a proper linter to check the code.
All related files where moved out from the root in a dedicated folder to avoid polluting the Rust environment.
This commit is contained in:
daxpedda 2024-07-27 18:26:52 +02:00 committed by GitHub
parent 7b0104b54c
commit 7892e86731
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 120 additions and 13 deletions

View file

@ -175,7 +175,7 @@ impl Schedule {
F: 'static + FnMut(),
{
thread_local! {
static URL: ScriptUrl = ScriptUrl::new(include_str!("worker.min.js"));
static URL: ScriptUrl = ScriptUrl::new(include_str!("../script/worker.min.js"));
static WORKER: Worker = URL.with(|url| Worker::new(&url.0)).expect("`new Worker()` is not expected to fail with a local script");
}

View file

@ -1,10 +0,0 @@
onmessage = event => {
const [port, timeout] = event.data
const f = () => port.postMessage(undefined)
if ('scheduler' in this) {
scheduler.postTask(f, { delay: timeout })
} else {
setTimeout(f, timeout)
}
}

View file

@ -1 +0,0 @@
onmessage=e=>{let[s,t]=e.data,a=()=>s.postMessage(void 0);"scheduler"in this?scheduler.postTask(a,{delay:t}):setTimeout(a,t)};