8 Commits

Author SHA1 Message Date
Caesar2011
6792813ffe Merge pull request #3 from leggenda47/master
Fix script execution.
2020-09-08 15:25:39 +02:00
Petróczi Zoltán
83373b6c7b Fix script execution. 2020-07-07 17:07:48 +02:00
Caesar2011
ff02c8a5a4 Updated URL 2020-06-07 11:49:42 +02:00
Caesar2011
a1f1822c64 Merge pull request #1 from mrothNET/patch-1
Remove double process start on init
2020-05-14 20:34:07 +02:00
Michael Roth
20957dcda8 Merge branch 'master' into patch-1 2020-05-14 19:41:41 +02:00
Caesar2011
9ac5f17b1c Merge pull request #2 from mrothNET/patch-2
Remove unused appInitTime
2020-05-14 17:55:05 +02:00
Michael Roth
2789b6b2e7 Remove unused appInitTime 2020-05-12 00:21:24 +02:00
Michael Roth
6219528dcb Remove double process start on init 2020-05-12 00:00:37 +02:00
2 changed files with 3 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ the following code runs `deno --allow-net example.ts` which is located in `/some
```bash
/some/work/dir$ deno --allow-run --allow-read https://raw.githubusercontent.com/Caesar2011/rhinoder/master/mod.ts --allow-net example.ts
/some/work/dir$ deno run --allow-run --allow-read https://deno.land/x/rhinoder@v1.2.0/mod.ts --allow-net example.ts
```
## Thanks to

8
mod.ts
View File

@@ -1,23 +1,19 @@
function startProcess(args: string[] = []): Deno.Process {
return Deno.run({ cmd: ['deno', ...args] });
return Deno.run({ cmd: ['deno', 'run', ...args] });
}
const throttle = 500;
let app: Deno.Process = startProcess(Deno.args);
let appInitTime: number = Date.now();
let timeout: number|null = null;
function runApp() {
appInitTime = Date.now();
app && app.close();
app = startProcess(Deno.args);
}
runApp();
for await (const event of Deno.watchFs('.')) {
if (event.kind !== "access") {
if (timeout) clearTimeout(timeout);
timeout = setTimeout(runApp, throttle);
}
}
}