Skip to content

Commit eb31f2c

Browse files
tbondwilkinsonatscott
authored andcommitted
refactor(core): Remove custom event and replay behavior. (angular#55695)
These behaviors have been moved back to g3. PR Close angular#55695
1 parent 7c9d37d commit eb31f2c

File tree

8 files changed

+6
-728
lines changed

8 files changed

+6
-728
lines changed

goldens/public-api/core/primitives/event-dispatch/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export class EventContract implements UnrenamedEventContract {
3232
addEvent(eventType: string, prefixedEventType?: string): void;
3333
cleanUp(): void;
3434
// (undocumented)
35-
static CUSTOM_EVENT_SUPPORT: boolean;
36-
// (undocumented)
3735
ecaacs?: (updateEventInfoForA11yClick: typeof a11yClickLib.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClickLib.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClickLib.populateClickOnlyAction) => void;
3836
ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
3937
exportAddA11yClickSupport(): void;

packages/core/primitives/event-dispatch/src/action_resolver.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const DEFAULT_EVENT_TYPE: string = EventType.CLICK;
3232
/** Resolves actions for Events. */
3333
export class ActionResolver {
3434
private a11yClickSupport: boolean = false;
35-
private readonly customEventSupport: boolean;
3635
private readonly syntheticMouseEventSupport: boolean;
3736

3837
private updateEventInfoForA11yClick?: (eventInfo: eventInfoLib.EventInfo) => void = undefined;
@@ -46,30 +45,14 @@ export class ActionResolver {
4645
) => void = undefined;
4746

4847
constructor({
49-
customEventSupport = false,
5048
syntheticMouseEventSupport = false,
5149
}: {
52-
customEventSupport?: boolean;
5350
syntheticMouseEventSupport?: boolean;
5451
} = {}) {
55-
this.customEventSupport = customEventSupport;
5652
this.syntheticMouseEventSupport = syntheticMouseEventSupport;
5753
}
5854

5955
resolve(eventInfo: eventInfoLib.EventInfo) {
60-
if (this.customEventSupport) {
61-
if (eventInfoLib.getEventType(eventInfo) === EventType.CUSTOM) {
62-
const detail = (eventInfoLib.getEvent(eventInfo) as CustomEvent).detail;
63-
// For custom events, use a secondary dispatch based on the internal
64-
// custom type of the event.
65-
if (!detail || !detail['_type']) {
66-
// This should never happen.
67-
return;
68-
}
69-
eventInfoLib.setEventType(eventInfo, detail['_type']);
70-
}
71-
}
72-
7356
this.populateAction(eventInfo);
7457
}
7558

packages/core/primitives/event-dispatch/src/custom_events.ts

Lines changed: 0 additions & 124 deletions
This file was deleted.

packages/core/primitives/event-dispatch/src/event_contract_defines.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,3 @@ export const A11Y_CLICK_SUPPORT = false;
1717
* flag can be overridden in a build rule.
1818
*/
1919
export const MOUSE_SPECIAL_SUPPORT = false;
20-
21-
/**
22-
* @define Support for custom events, which are type EventType.CUSTOM. These are
23-
* native DOM events with an additional type field and an optional payload.
24-
*/
25-
export const CUSTOM_EVENT_SUPPORT = false;

packages/core/primitives/event-dispatch/src/eventcontract.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ import {ActionResolver} from './action_resolver';
3535
import {EarlyJsactionData, EarlyJsactionDataContainer} from './earlyeventcontract';
3636
import * as eventLib from './event';
3737
import {EventContractContainerManager} from './event_contract_container';
38-
import {
39-
A11Y_CLICK_SUPPORT,
40-
CUSTOM_EVENT_SUPPORT,
41-
MOUSE_SPECIAL_SUPPORT,
42-
} from './event_contract_defines';
38+
import {A11Y_CLICK_SUPPORT, MOUSE_SPECIAL_SUPPORT} from './event_contract_defines';
4339
import * as eventInfoLib from './event_info';
4440
import {EventType} from './event_type';
4541
import {Restriction} from './restriction';
@@ -87,14 +83,12 @@ type EventHandler = (eventType: string, event: Event, container: Element) => voi
8783
* be delay loaded in a generic way.
8884
*/
8985
export class EventContract implements UnrenamedEventContract {
90-
static CUSTOM_EVENT_SUPPORT = CUSTOM_EVENT_SUPPORT;
9186
static A11Y_CLICK_SUPPORT = A11Y_CLICK_SUPPORT;
9287
static MOUSE_SPECIAL_SUPPORT = MOUSE_SPECIAL_SUPPORT;
9388

9489
private containerManager: EventContractContainerManager | null;
9590

9691
private readonly actionResolver = new ActionResolver({
97-
customEventSupport: EventContract.CUSTOM_EVENT_SUPPORT,
9892
syntheticMouseEventSupport: EventContract.MOUSE_SPECIAL_SUPPORT,
9993
});
10094

@@ -135,9 +129,6 @@ export class EventContract implements UnrenamedEventContract {
135129

136130
constructor(containerManager: EventContractContainerManager) {
137131
this.containerManager = containerManager;
138-
if (EventContract.CUSTOM_EVENT_SUPPORT) {
139-
this.addEvent(EventType.CUSTOM);
140-
}
141132
if (EventContract.A11Y_CLICK_SUPPORT) {
142133
// Add a11y click support to the `EventContract`.
143134
this.addA11yClickSupport();

0 commit comments

Comments
 (0)