Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 7b6e1e7

Browse files
committed
Clean up
1 parent a6d977e commit 7b6e1e7

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

framework/core/hmr.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import events from './events.ts'
22

3-
interface Callback {
4-
(...args: any[]): void
5-
}
6-
73
class Module {
84
private _specifier: string
9-
private _isLocked: boolean = false
105
private _isAccepted: boolean = false
11-
private _acceptCallbacks: Callback[] = []
6+
private _isLocked: boolean = false
7+
private _acceptCallbacks: CallableFunction[] = []
128

139
get specifier() {
1410
return this._specifier
@@ -18,11 +14,8 @@ class Module {
1814
this._specifier = specifier
1915
}
2016

21-
lock(): void {
22-
this._isLocked = true
23-
}
2417

25-
accept(callback?: Callback): void {
18+
accept(callback?: CallableFunction): void {
2619
if (this._isLocked) {
2720
return
2821
}
@@ -35,6 +28,10 @@ class Module {
3528
}
3629
}
3730

31+
lock(): void {
32+
this._isLocked = true
33+
}
34+
3835
async applyUpdate(url: string) {
3936
try {
4037
const module = await import(url + '?t=' + Date.now())
@@ -149,7 +146,6 @@ Object.assign(window, {
149146
mod.lock()
150147
return mod
151148
}
152-
153149
const mod = new Module(specifier)
154150
modules.set(specifier, mod)
155151
return mod

0 commit comments

Comments
 (0)