This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
1
import events from './events.ts'
2
2
3
- interface Callback {
4
- ( ...args : any [ ] ) : void
5
- }
6
-
7
3
class Module {
8
4
private _specifier : string
9
- private _isLocked : boolean = false
10
5
private _isAccepted : boolean = false
11
- private _acceptCallbacks : Callback [ ] = [ ]
6
+ private _isLocked : boolean = false
7
+ private _acceptCallbacks : CallableFunction [ ] = [ ]
12
8
13
9
get specifier ( ) {
14
10
return this . _specifier
@@ -18,11 +14,8 @@ class Module {
18
14
this . _specifier = specifier
19
15
}
20
16
21
- lock ( ) : void {
22
- this . _isLocked = true
23
- }
24
17
25
- accept ( callback ?: Callback ) : void {
18
+ accept ( callback ?: CallableFunction ) : void {
26
19
if ( this . _isLocked ) {
27
20
return
28
21
}
@@ -35,6 +28,10 @@ class Module {
35
28
}
36
29
}
37
30
31
+ lock ( ) : void {
32
+ this . _isLocked = true
33
+ }
34
+
38
35
async applyUpdate ( url : string ) {
39
36
try {
40
37
const module = await import ( url + '?t=' + Date . now ( ) )
@@ -149,7 +146,6 @@ Object.assign(window, {
149
146
mod . lock ( )
150
147
return mod
151
148
}
152
-
153
149
const mod = new Module ( specifier )
154
150
modules . set ( specifier , mod )
155
151
return mod
You can’t perform that action at this time.
0 commit comments