File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/core/src/event_dispatch Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 66 * found in the LICENSE file at https://angular.io/license
77 */
88
9+ import { EventContract } from '@angular/core/primitives/event-dispatch' ;
910import { ENVIRONMENT_INITIALIZER , Injector } from '../di' ;
1011import { inject } from '../di/injector_compatibility' ;
1112import { Provider } from '../di/interface/provider' ;
@@ -18,10 +19,18 @@ import {
1819
1920import { IS_GLOBAL_EVENT_DELEGATION_ENABLED } from '../hydration/tokens' ;
2021
22+ declare global {
23+ interface Window {
24+ __jsaction_contract : EventContract | undefined ;
25+ }
26+ }
27+
2128/**
2229 * Returns a set of providers required to setup support for event delegation.
30+ * @param multiContract - Experimental support to provide one event contract
31+ * when there are multiple binaries on the page.
2332 */
24- export function provideGlobalEventDelegation ( ) : Provider [ ] {
33+ export function provideGlobalEventDelegation ( multiContract = false ) : Provider [ ] {
2534 return [
2635 {
2736 provide : IS_GLOBAL_EVENT_DELEGATION_ENABLED ,
@@ -32,7 +41,12 @@ export function provideGlobalEventDelegation(): Provider[] {
3241 useValue : ( ) => {
3342 const injector = inject ( Injector ) ;
3443 const eventContractDetails = injector . get ( JSACTION_EVENT_CONTRACT ) ;
44+ if ( multiContract && window . __jsaction_contract ) {
45+ eventContractDetails . instance = window . __jsaction_contract ;
46+ return ;
47+ }
3548 initGlobalEventDelegation ( eventContractDetails , injector ) ;
49+ window . __jsaction_contract = eventContractDetails . instance ;
3650 } ,
3751 multi : true ,
3852 } ,
You can’t perform that action at this time.
0 commit comments