Created
April 24, 2016 15:03
-
-
Save TheLarkInn/81083e4cd60265b46ec2dbca7c8c945a to your computer and use it in GitHub Desktop.
An empty EventManagerPlugin extension, accompanied by the EventManagerPlugins definition file so we can see how to implement it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OpaqueToken } from 'angular2/src/core/di'; | |
import { NgZone } from 'angular2/src/core/zone/ng_zone'; | |
export declare const EVENT_MANAGER_PLUGINS: OpaqueToken; | |
export declare class EventManager { | |
private _zone; | |
private _plugins; | |
constructor(plugins: EventManagerPlugin[], _zone: NgZone); | |
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function; | |
addGlobalEventListener(target: string, eventName: string, handler: Function): Function; | |
getZone(): NgZone; | |
} | |
export declare class EventManagerPlugin { | |
manager: EventManager; | |
supports(eventName: string): boolean; | |
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function; | |
addGlobalEventListener(element: string, eventName: string, handler: Function): Function; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {EventManagerPlugin} from 'angular2/platform/common_dom'; | |
import {Injectable} from 'angular2/core'; | |
@Injectable() | |
export class MultiEventPlugin extends EventManagerPlugin { | |
supports(eventName: string): boolean { | |
} | |
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function { | |
} | |
addGlobalEventListener(target: string, eventName: string, handler: Function): Function { | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment