(winId: WinId, iframe: WorkerInstance)
| 180 | }; |
| 181 | |
| 182 | export const insertIframe = (winId: WinId, iframe: WorkerInstance) => { |
| 183 | // an iframe element's instanceId is also |
| 184 | // the winId of its contentWindow |
| 185 | let i = 0; |
| 186 | let type: string; |
| 187 | let handlers: EventHandler[]; |
| 188 | |
| 189 | let callback = () => { |
| 190 | if ( |
| 191 | environments[winId] && |
| 192 | environments[winId].$isInitialized$ && |
| 193 | !environments[winId].$isLoading$ |
| 194 | ) { |
| 195 | type = getInstanceStateValue<StateProp>(iframe, StateProp.loadErrorStatus) |
| 196 | ? StateProp.errorHandlers |
| 197 | : StateProp.loadHandlers; |
| 198 | |
| 199 | handlers = getInstanceStateValue<EventHandler[]>(iframe, type); |
| 200 | if (handlers) { |
| 201 | handlers.map((handler) => handler({ type })); |
| 202 | } |
| 203 | } else if (i++ > 2000) { |
| 204 | handlers = getInstanceStateValue<EventHandler[]>(iframe, StateProp.errorHandlers); |
| 205 | if (handlers) { |
| 206 | handlers.map((handler) => handler({ type: StateProp.errorHandlers })); |
| 207 | } |
| 208 | } else { |
| 209 | setTimeout(callback, 9); |
| 210 | } |
| 211 | }; |
| 212 | |
| 213 | callback(); |
| 214 | }; |
| 215 | |
| 216 | const resolveBaseLocation = (env: WebWorkerEnvironment, baseLocation?: Location) => { |
| 217 | baseLocation = env.$location$; |
no test coverage detected
searching dependent graphs…