- PlatformState provides an interface to serialize the current Platform State as a string or Document. - renderModule and renderModuleFactory are convenience methods to wait for Angular Application to stabilize and then render the state to a string. - refactor code to remove defaultDoc from DomAdapter and inject DOCUMENT where it's needed.
28 lines
872 B
TypeScript
28 lines
872 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {Inject, Injectable} from '@angular/core';
|
|
|
|
import {DOCUMENT} from '../dom_tokens';
|
|
|
|
import {EventManagerPlugin} from './event_manager';
|
|
|
|
@Injectable()
|
|
export class DomEventsPlugin extends EventManagerPlugin {
|
|
constructor(@Inject(DOCUMENT) doc: any) { super(doc); }
|
|
|
|
// This plugin should come last in the list of plugins, because it accepts all
|
|
// events.
|
|
supports(eventName: string): boolean { return true; }
|
|
|
|
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {
|
|
element.addEventListener(eventName, handler as any, false);
|
|
return () => element.removeEventListener(eventName, handler as any, false);
|
|
}
|
|
}
|