forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasync.d.ts
More file actions
81 lines (81 loc) · 2.84 KB
/
async.d.ts
File metadata and controls
81 lines (81 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
export { PromiseWrapper, PromiseCompleter } from 'angular2/src/facade/promise';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
export { Observable } from 'rxjs/Observable';
export { Subject } from 'rxjs/Subject';
export declare class TimerWrapper {
static setTimeout(fn: (...args: any[]) => void, millis: number): number;
static clearTimeout(id: number): void;
static setInterval(fn: (...args: any[]) => void, millis: number): number;
static clearInterval(id: number): void;
}
export declare class ObservableWrapper {
static subscribe<T>(emitter: any, onNext: (value: T) => void, onError?: (exception: any) => void, onComplete?: () => void): Object;
static isObservable(obs: any): boolean;
/**
* Returns whether `obs` has any subscribers listening to events.
*/
static hasSubscribers(obs: EventEmitter<any>): boolean;
static dispose(subscription: any): void;
/**
* @deprecated - use callEmit() instead
*/
static callNext(emitter: EventEmitter<any>, value: any): void;
static callEmit(emitter: EventEmitter<any>, value: any): void;
static callError(emitter: EventEmitter<any>, error: any): void;
static callComplete(emitter: EventEmitter<any>): void;
static fromPromise(promise: Promise<any>): Observable<any>;
static toPromise(obj: Observable<any>): Promise<any>;
}
/**
* 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: `
* <div class="zippy">
* <div (click)="toggle()">Toggle</div>
* <div [hidden]="!visible">
* <ng-content></ng-content>
* </div>
* </div>`})
* export class Zippy {
* visible: boolean = true;
* @Output() open: EventEmitter<any> = new EventEmitter();
* @Output() close: EventEmitter<any> = new EventEmitter();
*
* toggle() {
* this.visible = !this.visible;
* if (this.visible) {
* this.open.emit(null);
* } else {
* this.close.emit(null);
* }
* }
* }
* ```
*
* Use 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.
*/
export declare class EventEmitter<T> extends Subject<T> {
/**
* Creates an instance of [EventEmitter], which depending on [isAsync],
* delivers events synchronously or asynchronously.
*/
constructor(isAsync?: boolean);
emit(value: T): void;
/**
* @deprecated - use .emit(value) instead
*/
next(value: any): void;
subscribe(generatorOrNext?: any, error?: any, complete?: any): any;
}