(eventDelegation: EventContractDetails, injector: Injector)
| 214 | |
| 215 | /** @returns false if there was no early event data to replay (another app already used it). */ |
| 216 | const initEventReplay = (eventDelegation: EventContractDetails, injector: Injector): boolean => { |
| 217 | const appId = injector.get(APP_ID); |
| 218 | // This is set in packages/platform-server/src/utils.ts. Two apps can share an APP_ID |
| 219 | // (duplicate bootstrap script, embedded widget), so it may already be cleared. |
| 220 | const earlyJsactionData = window._ejsas?.[appId]; |
| 221 | if (!earlyJsactionData) { |
| 222 | console.warn( |
| 223 | formatRuntimeError( |
| 224 | RuntimeErrorCode.EVENT_REPLAY_CONTRACT_ALREADY_CONSUMED, |
| 225 | ngDevMode && |
| 226 | `Event replay was skipped for APP_ID "${appId}". Another application on this page ` + |
| 227 | `already consumed the early event contract for this APP_ID. APP_ID must be unique ` + |
| 228 | `per application when multiple Angular applications share a page.`, |
| 229 | ), |
| 230 | ); |
| 231 | return false; |
| 232 | } |
| 233 | const eventContract = (eventDelegation.instance = new EventContract( |
| 234 | new EventContractContainer(earlyJsactionData.c), |
| 235 | )); |
| 236 | for (const et of earlyJsactionData.et) { |
| 237 | eventContract.addEvent(et); |
| 238 | } |
| 239 | for (const et of earlyJsactionData.etc) { |
| 240 | eventContract.addEvent(et); |
| 241 | } |
| 242 | const eventInfos = getAppScopedQueuedEventInfos(appId); |
| 243 | eventContract.replayEarlyEventInfos(eventInfos); |
| 244 | clearAppScopedEarlyEventContract(appId); |
| 245 | const dispatcher = new EventDispatcher((event) => { |
| 246 | invokeRegisteredReplayListeners(injector, event, event.currentTarget as Element); |
| 247 | }); |
| 248 | registerDispatcher(eventContract, dispatcher); |
| 249 | return true; |
| 250 | }; |
| 251 | |
| 252 | /** |
| 253 | * Extracts information about all DOM events (added in a template) registered on elements in a give |
no test coverage detected