Skip to content

Commit

Permalink
refactor(WebSocketSubject): use NextObserver for open, close & closin…
Browse files Browse the repository at this point in the history
…g observers

Since only next() is called, no need to request a full Observer.
Also makes code more explicit on expectations.
  • Loading branch information
mdhooge authored and kwonoj committed Mar 29, 2016
1 parent ff06dfe commit cc9f6f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/observable/dom/WebSocketSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Operator} from '../../Operator';
import {Subscription} from '../../Subscription';
import {root} from '../../util/root';
import {ReplaySubject} from '../../subject/ReplaySubject';
import {Observer} from '../../Observer';
import {Observer, NextObserver} from '../../Observer';
import {tryCatch} from '../../util/tryCatch';
import {errorObject} from '../../util/errorObject';
import {assign} from '../../util/assign';
Expand All @@ -14,9 +14,9 @@ export interface WebSocketSubjectConfig {
url: string;
protocol?: string | Array<string>;
resultSelector?: <T>(e: MessageEvent) => T;
openObserver?: Observer<Event>;
closeObserver?: Observer<CloseEvent>;
closingObserver?: Observer<void>;
openObserver?: NextObserver<Event>;
closeObserver?: NextObserver<CloseEvent>;
closingObserver?: NextObserver<void>;
WebSocketCtor?: { new(url: string, protocol?: string|Array<string>): WebSocket };
}

Expand All @@ -29,9 +29,9 @@ export class WebSocketSubject<T> extends Subject<T> {
url: string;
protocol: string|Array<string>;
socket: WebSocket;
openObserver: Observer<Event>;
closeObserver: Observer<CloseEvent>;
closingObserver: Observer<void>;
openObserver: NextObserver<Event>;
closeObserver: NextObserver<CloseEvent>;
closingObserver: NextObserver<void>;
WebSocketCtor: { new(url: string, protocol?: string|Array<string>): WebSocket };

resultSelector(e: MessageEvent) {
Expand Down

0 comments on commit cc9f6f2

Please sign in to comment.