Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created February 12, 2019 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/4dff6419ee58c90f33b76c9cba54e8dd to your computer and use it in GitHub Desktop.
Save NetanelBasal/4dff6419ee58c90f33b76c9cba54e8dd to your computer and use it in GitHub Desktop.
@Injectable()
export class EventManager {
constructor(@Inject(EVENT_MANAGER_PLUGINS) plugins: EventManagerPlugin[], private _zone: NgZone) {
plugins.forEach(p => p.manager = this);
this._plugins = plugins.slice().reverse();
}
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {
const plugin = this._findPluginFor(eventName);
return plugin.addEventListener(element, eventName, handler);
}
getZone(): NgZone { return this._zone; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment