We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent baa0286 commit 54f4958Copy full SHA for 54f4958
minimon-3.mjs
@@ -2,24 +2,15 @@
2
3
import 'zx/globals'
4
import chokidar from 'chokidar'
5
-import { EventEmitter } from 'events'
6
7
let node
8
-let ee = new EventEmitter()
9
10
chokidar
11
.watch(['**/*.mjs', '**/*.js'], {
12
ignoreInitial: true,
13
ignored: ['**/node_modules/**'],
14
})
15
- .on('all', () => {
16
- node.kill()
17
- })
18
-
19
-ee.on('restart', async () => {
20
- console.log('Restarting')
21
- await start()
22
-})
+ .on('all', () => node.kill())
23
24
await start()
25
@@ -28,6 +19,6 @@ async function start () {
28
try {
29
await node
30
} catch {
31
- ee.emit('restart')
+ start()
32
}
33
-}
+}
0 commit comments