@@ -5,28 +5,14 @@ import {
5
5
Destroy ,
6
6
Destroyed ,
7
7
ImportedModule ,
8
- Init ,
9
8
MessageToView ,
10
- Ready ,
11
9
ShadowObjectsExport ,
12
10
} from '../constants.js' ;
13
11
import { Kernel , type MessageToViewEvent } from '../entities/Kernel.js' ;
14
- import { shadowObjects } from '../entities/ShadowObject.js' ;
15
12
import { importModule } from '../entities/importModule.js' ;
16
- import type {
17
- AppliedChangeTrailEvent ,
18
- ImportedModuleEvent ,
19
- ShadowObjectConstructor ,
20
- ShadowObjectsModule ,
21
- SyncEvent ,
22
- } from '../types.js' ;
13
+ import type { AppliedChangeTrailEvent , ImportedModuleEvent , ShadowObjectsModule , SyncEvent } from '../types.js' ;
23
14
import { toUrlString } from '../utils/toUrlString.js' ;
24
15
25
- // TODO(cleanup) remove InitPayloadData
26
- interface InitPayloadData {
27
- importSrc ?: string ;
28
- }
29
-
30
16
interface ConfigurePayloadData {
31
17
importModule ?: string ;
32
18
}
@@ -53,11 +39,6 @@ export class MessageRouter {
53
39
54
40
route ( event : MessageEvent ) {
55
41
switch ( event . data . type ) {
56
- case Init :
57
- // TODO(cleanup) remove Init event
58
- this . #onInit( event . data ) ;
59
- break ;
60
-
61
42
case Configure :
62
43
this . #configure( event . data ) ;
63
44
break ;
@@ -114,41 +95,10 @@ export class MessageRouter {
114
95
}
115
96
}
116
97
117
- // TODO(cleanup) remove onInit
118
- #onInit( data : InitPayloadData ) {
119
- // console.debug('[MessageRouter] on init', data);
120
-
121
- if ( 'importSrc' in data ) {
122
- this . #loadScript( data . importSrc ) ;
123
- } else {
124
- console . error ( '[MessageRouter] missing importSrc property!' ) ;
125
- }
126
- }
127
-
128
98
#onDestroy( data : any ) {
129
99
console . debug ( '[MessageRouter] on destroy' , data ) ;
130
100
this . kernel . off ( this ) ;
131
101
this . #importedModules. clear ( ) ;
132
102
this . postMessage ( { type : Destroyed } ) ;
133
103
}
134
-
135
- // TODO(cleanup) remove loadScript
136
- async #loadScript( src : string ) {
137
- const mod = await import ( /* @vite -ignore */ src ) ;
138
-
139
- // console.debug('[MessageRouter] imported', vfxMod);
140
-
141
- if ( typeof mod . onload === 'function' ) {
142
- mod . onload ( {
143
- shadowObjects : {
144
- define : ( token : string , constructor : ShadowObjectConstructor ) =>
145
- shadowObjects . define ( token , constructor , this . kernel . registry ) ,
146
- } ,
147
- kernel : this . kernel ,
148
- registry : this . kernel . registry ,
149
- } ) ;
150
- }
151
-
152
- this . postMessage ( { type : Ready } ) ;
153
- }
154
104
}
0 commit comments