Skip to content

Commit

Permalink
refactor(patches): move static observable stubs from Observable.ts to…
Browse files Browse the repository at this point in the history
… patch files
  • Loading branch information
david-driscoll committed Feb 4, 2016
1 parent 7b6da90 commit 2e6da38
Show file tree
Hide file tree
Showing 24 changed files with 113 additions and 68 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"systemjs": "^0.19.6",
"systemjs-builder": "^0.10.6",
"tslint": "3.3.0-dev.2",
"typescript": "1.9.0-dev.20160128",
"typescript": "1.9.0-dev.20160202",
"validate-commit-msg": "1.1.1",
"watch": "0.16.0",
"watchify": "3.7.0",
Expand Down
45 changes: 1 addition & 44 deletions src/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,7 @@ import {toSubscriber} from './util/toSubscriber';
import {tryCatch} from './util/tryCatch';
import {errorObject} from './util/errorObject';

import {combineLatestStatic} from './operator/combineLatest';
import {concatStatic} from './operator/concat';
import {mergeStatic} from './operator/merge';
import {zipStatic} from './operator/zip';
import {BoundCallbackObservable} from './observable/BoundCallbackObservable';
import {BoundNodeCallbackObservable} from './observable/BoundNodeCallbackObservable';
import {DeferObservable} from './observable/DeferObservable';
import {EmptyObservable} from './observable/EmptyObservable';
import {ForkJoinObservable} from './observable/ForkJoinObservable';
import {FromObservable} from './observable/FromObservable';
import {ArrayObservable} from './observable/ArrayObservable';
import {FromEventObservable} from './observable/FromEventObservable';
import {FromEventPatternObservable} from './observable/FromEventPatternObservable';
import {PromiseObservable} from './observable/PromiseObservable';
import {IntervalObservable} from './observable/IntervalObservable';
import {TimerObservable} from './observable/TimerObservable';
import {raceStatic} from './operator/race';
import {RangeObservable} from './observable/RangeObservable';
import {NeverObservable} from './observable/NeverObservable';
import {ErrorObservable} from './observable/ErrorObservable';
import {AjaxCreationMethod} from './observable/dom/AjaxObservable';
import {WebSocketSubject} from './observable/dom/WebSocketSubject';

import {CombineLatestSignature} from './operator/combineLatest';

Expand Down Expand Up @@ -167,30 +146,8 @@ export class Observable<T> implements CoreOperators<T> {
return this.source.subscribe(subscriber);
}

// static method stubs
static ajax: AjaxCreationMethod;
static bindCallback: typeof BoundCallbackObservable.create;
static bindNodeCallback: typeof BoundNodeCallbackObservable.create;
static combineLatest: typeof combineLatestStatic;
static concat: typeof concatStatic;
static defer: typeof DeferObservable.create;
static empty: typeof EmptyObservable.create;
static forkJoin: typeof ForkJoinObservable.create;
static from: typeof FromObservable.create;
static fromArray: typeof ArrayObservable.create;
static fromEvent: typeof FromEventObservable.create;
static fromEventPattern: typeof FromEventPatternObservable.create;
static fromPromise: typeof PromiseObservable.create;
static interval: typeof IntervalObservable.create;
static merge: typeof mergeStatic;
static never: typeof NeverObservable.create;
static of: typeof ArrayObservable.of;
static race: typeof raceStatic;
static range: typeof RangeObservable.create;
// Throw is the special snow flake, the compiler sees it as a reserved word
static throw: typeof ErrorObservable.create;
static timer: typeof TimerObservable.create;
static webSocket: typeof WebSocketSubject.create;
static zip: typeof zipStatic;

// core operators
buffer: (closingNotifier: Observable<any>) => Observable<T[]>;
Expand Down
6 changes: 5 additions & 1 deletion src/add/observable/bindCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {BoundCallbackObservable} from '../../observable/BoundCallbackObservable'

Observable.bindCallback = BoundCallbackObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let bindCallback: typeof BoundCallbackObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/bindNodeCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {BoundNodeCallbackObservable} from '../../observable/BoundNodeCallbackObs

Observable.bindNodeCallback = BoundNodeCallbackObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let bindNodeCallback: typeof BoundNodeCallbackObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/combineLatest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {combineLatestStatic} from '../../operator/combineLatest';

Observable.combineLatest = combineLatestStatic;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let combineLatest: typeof combineLatestStatic;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ import {concatStatic} from '../../operator/concat';

Observable.concat = concatStatic;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let concat: typeof concatStatic;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/defer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {DeferObservable} from '../../observable/DeferObservable';

Observable.defer = DeferObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let defer: typeof DeferObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/dom/ajax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ import {AjaxObservable} from '../../../observable/dom/AjaxObservable';

Observable.ajax = AjaxObservable.create;

export var _void: void;
declare module '../../../Observable' {
namespace Observable {
export let ajax: typeof AjaxObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/dom/webSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ import {WebSocketSubject} from '../../../observable/dom/WebSocketSubject';

Observable.webSocket = WebSocketSubject.create;

export var _void: void;
declare module '../../../Observable' {
namespace Observable {
export let webSocket: typeof WebSocketSubject.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {EmptyObservable} from '../../observable/EmptyObservable';

Observable.empty = EmptyObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let empty: typeof EmptyObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/forkJoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {ForkJoinObservable} from '../../observable/ForkJoinObservable';

Observable.forkJoin = ForkJoinObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let forkJoin: typeof ForkJoinObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/from.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {FromObservable} from '../../observable/FromObservable';

Observable.from = FromObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let from: typeof FromObservable.create;
}
}
8 changes: 6 additions & 2 deletions src/add/observable/fromArray.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import {Observable} from '../../Observable';
import {ArrayObservable} from '../../observable/ArrayObservable';
import './of';

Observable.fromArray = ArrayObservable.create;
Observable.of = ArrayObservable.of;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let fromArray: typeof ArrayObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/fromEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {FromEventObservable} from '../../observable/FromEventObservable';

Observable.fromEvent = FromEventObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let fromEvent: typeof FromEventObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/fromEventPattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {FromEventPatternObservable} from '../../observable/FromEventPatternObser

Observable.fromEventPattern = FromEventPatternObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let fromEventPattern: typeof FromEventPatternObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/fromPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {PromiseObservable} from '../../observable/PromiseObservable';

Observable.fromPromise = PromiseObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let fromPromise: typeof PromiseObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {IntervalObservable} from '../../observable/IntervalObservable';

Observable.interval = IntervalObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let interval: typeof IntervalObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ import {mergeStatic} from '../../operator/merge';

Observable.merge = mergeStatic;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let merge: typeof mergeStatic;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/never.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {NeverObservable} from '../../observable/NeverObservable';

Observable.never = NeverObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let never: typeof NeverObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {ArrayObservable} from '../../observable/ArrayObservable';

Observable.of = ArrayObservable.of;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let of: typeof ArrayObservable.of;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/race.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {raceStatic} from '../../operator/race';

Observable.race = raceStatic;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let race: typeof raceStatic;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {RangeObservable} from '../../observable/RangeObservable';

Observable.range = RangeObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let range: typeof RangeObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {TimerObservable} from '../../observable/TimerObservable';

Observable.timer = TimerObservable.create;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let timer: typeof TimerObservable.create;
}
}
6 changes: 5 additions & 1 deletion src/add/observable/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import {zipStatic} from '../../operator/zip';

Observable.zip = zipStatic;

export var _void: void;
declare module '../../Observable' {
namespace Observable {
export let zip: typeof zipStatic;
}
}

0 comments on commit 2e6da38

Please sign in to comment.