UNPKG

1.77 kBTypeScriptView Raw
1import { Stream } from 'xstream';
2import { IsolateModule } from './IsolateModule';
3import { EventsFnOptions } from './DOMSource';
4import { Scope } from './isolate';
5export interface CycleDOMEvent extends Event {
6 propagationHasBeenStopped: boolean;
7 ownerTarget: Element;
8}
9export declare const eventTypesThatDontBubble: string[];
10/**
11 * Manages "Event delegation", by connecting an origin with multiple
12 * destinations.
13 *
14 * Attaches a DOM event listener to the DOM element called the "origin",
15 * and delegates events to "destinations", which are subjects as outputs
16 * for the DOMSource. Simulates bubbling or capturing, with regards to
17 * isolation boundaries too.
18 */
19export declare class EventDelegator {
20 private rootElement$;
21 isolateModule: IsolateModule;
22 private virtualListeners;
23 private origin;
24 private domListeners;
25 private nonBubblingListeners;
26 private domListenersToAdd;
27 private nonBubblingListenersToAdd;
28 private virtualNonBubblingListener;
29 constructor(rootElement$: Stream<Element>, isolateModule: IsolateModule);
30 addEventListener(eventType: string, namespace: Array<Scope>, options: EventsFnOptions, bubbles?: boolean): Stream<Event>;
31 removeElement(element: Element, namespace?: Array<Scope>): void;
32 private insertListener;
33 /**
34 * Returns a set of all virtual listeners in the scope of the namespace
35 * Set `exact` to true to treat sibiling isolated scopes as total scopes
36 */
37 private getVirtualListeners;
38 private setupDOMListener;
39 private setupNonBubblingListener;
40 private resetEventListeners;
41 private putNonBubblingListener;
42 private onEvent;
43 private bubble;
44 private doBubbleStep;
45 private patchEvent;
46 private mutateEventCurrentTarget;
47}