/** * @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 { Subject } from 'rxjs/Subject'; /** * Use by directives and components to emit custom Events. * * ### Examples * * In the following example, `Zippy` alternatively emits `open` and `close` events when its * title gets clicked: * * ``` * @Component({ * selector: 'zippy', * template: ` *
*
Toggle
*
* *
*
`}) * export class Zippy { * visible: boolean = true; * @Output() open: EventEmitter = new EventEmitter(); * @Output() close: EventEmitter = new EventEmitter(); * * toggle() { * this.visible = !this.visible; * if (this.visible) { * this.open.emit(null); * } else { * this.close.emit(null); * } * } * } * ``` * * The events payload can be accessed by the parameter `$event` on the components output event * handler: * * ``` * * ``` * * Uses Rx.Observable but provides an adapter to make it work as specified here: * https://github.com/jhusain/observable-spec * * Once a reference implementation of the spec is available, switch to it. * @stable */ export declare class EventEmitter extends Subject { __isAsync: boolean; /** * Creates an instance of [EventEmitter], which depending on [isAsync], * delivers events synchronously or asynchronously. */ constructor(isAsync?: boolean); emit(value?: T): void; subscribe(generatorOrNext?: any, error?: any, complete?: any): any; }