Template Upload
This commit is contained in:
1 parent
415b9c25f3
commit
7efe7605b8
11476 files changed
+2170865
-34
No files matched your search
+100
@@ -0,0 +1,100 @@
|
||||
import { Observable } from '../../Observable';
|
||||
import { Subscriber } from '../../Subscriber';
|
||||
import { Subscription } from '../../Subscription';
|
||||
export interface AjaxRequest {
|
||||
url?: string;
|
||||
body?: any;
|
||||
user?: string;
|
||||
async?: boolean;
|
||||
method: string;
|
||||
headers?: Object;
|
||||
timeout?: number;
|
||||
password?: string;
|
||||
hasContent?: boolean;
|
||||
crossDomain?: boolean;
|
||||
createXHR?: () => XMLHttpRequest;
|
||||
progressSubscriber?: Subscriber<any>;
|
||||
resultSelector?: <T>(response: AjaxResponse) => T;
|
||||
responseType?: string;
|
||||
}
|
||||
export interface AjaxCreationMethod {
|
||||
(): <T>(urlOrRequest: string | AjaxRequest) => Observable<T>;
|
||||
get: <T>(url: string, resultSelector?: (response: AjaxResponse) => T, headers?: Object) => Observable<T>;
|
||||
post: <T>(url: string, body?: any, headers?: Object) => Observable<T>;
|
||||
put: <T>(url: string, body?: any, headers?: Object) => Observable<T>;
|
||||
delete: <T>(url: string, headers?: Object) => Observable<T>;
|
||||
getJSON: <T, R>(url: string, resultSelector?: (data: T) => R, headers?: Object) => Observable<R>;
|
||||
}
|
||||
export declare function ajaxGet<T>(url: string, resultSelector?: (response: AjaxResponse) => T, headers?: Object): AjaxObservable<T>;
|
||||
export declare function ajaxPost<T>(url: string, body?: any, headers?: Object): Observable<T>;
|
||||
export declare function ajaxDelete<T>(url: string, headers?: Object): Observable<T>;
|
||||
export declare function ajaxPut<T>(url: string, body?: any, headers?: Object): Observable<T>;
|
||||
export declare function ajaxGetJSON<T, R>(url: string, resultSelector?: (data: T) => R, headers?: Object): Observable<R>;
|
||||
/**
|
||||
* Creates an observable for an Ajax request with either a request object with url, headers, etc or a string for a URL.
|
||||
*
|
||||
* @example
|
||||
* source = Rx.Observable.ajax('/products');
|
||||
* source = Rx.Observable.ajax( url: 'products', method: 'GET' });
|
||||
*
|
||||
* @param {Object} request Can be one of the following:
|
||||
*
|
||||
* A string of the URL to make the Ajax call.
|
||||
* An object with the following properties
|
||||
* - url: URL of the request
|
||||
* - body: The body of the request
|
||||
* - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE
|
||||
* - async: Whether the request is async
|
||||
* - headers: Optional headers
|
||||
* - crossDomain: true if a cross domain request, else false
|
||||
* - createXHR: a function to override if you need to use an alternate XMLHttpRequest implementation.
|
||||
* - resultSelector: a function to use to alter the output value type of the Observable. Gets {AjaxResponse} as an argument
|
||||
* @returns {Observable} An observable sequence containing the XMLHttpRequest.
|
||||
*/
|
||||
export declare class AjaxObservable<T> extends Observable<T> {
|
||||
static create: AjaxCreationMethod;
|
||||
private request;
|
||||
constructor(urlOrRequest: string | AjaxRequest);
|
||||
protected _subscribe(subscriber: Subscriber<T>): Subscription | Function | void;
|
||||
}
|
||||
export declare class AjaxSubscriber<T> extends Subscriber<Event> {
|
||||
request: AjaxRequest;
|
||||
private xhr;
|
||||
private resultSelector;
|
||||
private done;
|
||||
constructor(destination: Subscriber<T>, request: AjaxRequest);
|
||||
next(e: Event): void;
|
||||
private send();
|
||||
private serializeBody(body, contentType);
|
||||
private setHeaders(xhr, headers);
|
||||
private setupEvents(xhr, request);
|
||||
unsubscribe(): void;
|
||||
}
|
||||
/** A normalized AJAX response */
|
||||
export declare class AjaxResponse {
|
||||
originalEvent: Event;
|
||||
xhr: XMLHttpRequest;
|
||||
request: AjaxRequest;
|
||||
/** {number} the HTTP status code */
|
||||
status: number;
|
||||
/** {string|ArrayBuffer|Document|object|any} the response data */
|
||||
response: any;
|
||||
/** {string} the raw responseText */
|
||||
responseText: string;
|
||||
/** {string} the responsType (e.g. 'json', 'arraybuffer', or 'xml') */
|
||||
responseType: string;
|
||||
constructor(originalEvent: Event, xhr: XMLHttpRequest, request: AjaxRequest);
|
||||
}
|
||||
/** A normalized AJAX error */
|
||||
export declare class AjaxError extends Error {
|
||||
/** {XMLHttpRequest} the XHR instance associated with the error */
|
||||
xhr: XMLHttpRequest;
|
||||
/** {AjaxRequest} the AjaxRequest associated with the error */
|
||||
request: AjaxRequest;
|
||||
/** {number} the HTTP status code */
|
||||
status: number;
|
||||
constructor(message: string, xhr: XMLHttpRequest, request: AjaxRequest);
|
||||
}
|
||||
export declare class AjaxTimeoutError extends AjaxError {
|
||||
constructor(xhr: XMLHttpRequest, request: AjaxRequest);
|
||||
}
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var _this = this;
|
||||
var root_1 = require('../../util/root');
|
||||
var tryCatch_1 = require('../../util/tryCatch');
|
||||
var errorObject_1 = require('../../util/errorObject');
|
||||
var Observable_1 = require('../../Observable');
|
||||
var Subscriber_1 = require('../../Subscriber');
|
||||
var createXHRDefault = function () {
|
||||
var xhr = new root_1.root.XMLHttpRequest();
|
||||
if (_this.crossDomain) {
|
||||
if ('withCredentials' in xhr) {
|
||||
xhr.withCredentials = true;
|
||||
return xhr;
|
||||
}
|
||||
else if (!!root_1.root.XDomainRequest) {
|
||||
return new root_1.root.XDomainRequest();
|
||||
}
|
||||
else {
|
||||
throw new Error('CORS is not supported by your browser');
|
||||
}
|
||||
}
|
||||
else {
|
||||
return xhr;
|
||||
}
|
||||
};
|
||||
function defaultGetResultSelector(response) {
|
||||
return response.response;
|
||||
}
|
||||
function ajaxGet(url, resultSelector, headers) {
|
||||
if (resultSelector === void 0) { resultSelector = defaultGetResultSelector; }
|
||||
if (headers === void 0) { headers = null; }
|
||||
return new AjaxObservable({ method: 'GET', url: url, resultSelector: resultSelector, headers: headers });
|
||||
}
|
||||
exports.ajaxGet = ajaxGet;
|
||||
;
|
||||
function ajaxPost(url, body, headers) {
|
||||
return new AjaxObservable({ method: 'POST', url: url, body: body, headers: headers });
|
||||
}
|
||||
exports.ajaxPost = ajaxPost;
|
||||
;
|
||||
function ajaxDelete(url, headers) {
|
||||
return new AjaxObservable({ method: 'DELETE', url: url, headers: headers });
|
||||
}
|
||||
exports.ajaxDelete = ajaxDelete;
|
||||
;
|
||||
function ajaxPut(url, body, headers) {
|
||||
return new AjaxObservable({ method: 'PUT', url: url, body: body, headers: headers });
|
||||
}
|
||||
exports.ajaxPut = ajaxPut;
|
||||
;
|
||||
function ajaxGetJSON(url, resultSelector, headers) {
|
||||
var finalResultSelector = resultSelector ? function (res) { return resultSelector(res.response); } : function (res) { return res.response; };
|
||||
return new AjaxObservable({ method: 'GET', url: url, responseType: 'json', resultSelector: finalResultSelector, headers: headers });
|
||||
}
|
||||
exports.ajaxGetJSON = ajaxGetJSON;
|
||||
;
|
||||
/**
|
||||
* Creates an observable for an Ajax request with either a request object with url, headers, etc or a string for a URL.
|
||||
*
|
||||
* @example
|
||||
* source = Rx.Observable.ajax('/products');
|
||||
* source = Rx.Observable.ajax( url: 'products', method: 'GET' });
|
||||
*
|
||||
* @param {Object} request Can be one of the following:
|
||||
*
|
||||
* A string of the URL to make the Ajax call.
|
||||
* An object with the following properties
|
||||
* - url: URL of the request
|
||||
* - body: The body of the request
|
||||
* - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE
|
||||
* - async: Whether the request is async
|
||||
* - headers: Optional headers
|
||||
* - crossDomain: true if a cross domain request, else false
|
||||
* - createXHR: a function to override if you need to use an alternate XMLHttpRequest implementation.
|
||||
* - resultSelector: a function to use to alter the output value type of the Observable. Gets {AjaxResponse} as an argument
|
||||
* @returns {Observable} An observable sequence containing the XMLHttpRequest.
|
||||
*/
|
||||
var AjaxObservable = (function (_super) {
|
||||
__extends(AjaxObservable, _super);
|
||||
function AjaxObservable(urlOrRequest) {
|
||||
_super.call(this);
|
||||
var request = {
|
||||
async: true,
|
||||
createXHR: createXHRDefault,
|
||||
crossDomain: false,
|
||||
headers: {},
|
||||
method: 'GET',
|
||||
responseType: 'json',
|
||||
timeout: 0
|
||||
};
|
||||
if (typeof urlOrRequest === 'string') {
|
||||
request.url = urlOrRequest;
|
||||
}
|
||||
else {
|
||||
for (var prop in urlOrRequest) {
|
||||
if (urlOrRequest.hasOwnProperty(prop)) {
|
||||
request[prop] = urlOrRequest[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.request = request;
|
||||
}
|
||||
AjaxObservable.prototype._subscribe = function (subscriber) {
|
||||
return new AjaxSubscriber(subscriber, this.request);
|
||||
};
|
||||
AjaxObservable.create = (function () {
|
||||
var create = function (urlOrRequest) {
|
||||
return new AjaxObservable(urlOrRequest);
|
||||
};
|
||||
create.get = ajaxGet;
|
||||
create.post = ajaxPost;
|
||||
create.delete = ajaxDelete;
|
||||
create.put = ajaxPut;
|
||||
create.getJSON = ajaxGetJSON;
|
||||
return create;
|
||||
})();
|
||||
return AjaxObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.AjaxObservable = AjaxObservable;
|
||||
var AjaxSubscriber = (function (_super) {
|
||||
__extends(AjaxSubscriber, _super);
|
||||
function AjaxSubscriber(destination, request) {
|
||||
_super.call(this, destination);
|
||||
this.request = request;
|
||||
this.done = false;
|
||||
var headers = request.headers = request.headers || {};
|
||||
// force CORS if requested
|
||||
if (!request.crossDomain && !headers['X-Requested-With']) {
|
||||
headers['X-Requested-With'] = 'XMLHttpRequest';
|
||||
}
|
||||
// ensure content type is set
|
||||
if (!('Content-Type' in headers)) {
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
}
|
||||
// properly serialize body
|
||||
request.body = this.serializeBody(request.body, request.headers['Content-Type']);
|
||||
this.resultSelector = request.resultSelector;
|
||||
this.send();
|
||||
}
|
||||
AjaxSubscriber.prototype.next = function (e) {
|
||||
this.done = true;
|
||||
var _a = this, resultSelector = _a.resultSelector, xhr = _a.xhr, request = _a.request, destination = _a.destination;
|
||||
var response = new AjaxResponse(e, xhr, request);
|
||||
if (resultSelector) {
|
||||
var result = tryCatch_1.tryCatch(resultSelector)(response);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
destination.next(result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
destination.next(response);
|
||||
}
|
||||
};
|
||||
AjaxSubscriber.prototype.send = function () {
|
||||
var _a = this, request = _a.request, _b = _a.request, user = _b.user, method = _b.method, url = _b.url, async = _b.async, password = _b.password, headers = _b.headers, body = _b.body;
|
||||
var createXHR = request.createXHR;
|
||||
var xhr = tryCatch_1.tryCatch(createXHR).call(request);
|
||||
if (xhr === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
this.xhr = xhr;
|
||||
// open XHR first
|
||||
var result = void 0;
|
||||
if (user) {
|
||||
result = tryCatch_1.tryCatch(xhr.open).call(xhr, method, url, async, user, password);
|
||||
}
|
||||
else {
|
||||
result = tryCatch_1.tryCatch(xhr.open).call(xhr, method, url, async);
|
||||
}
|
||||
if (result === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
return;
|
||||
}
|
||||
// timeout and responseType can be set once the XHR is open
|
||||
xhr.timeout = request.timeout;
|
||||
xhr.responseType = request.responseType;
|
||||
// set headers
|
||||
this.setHeaders(xhr, headers);
|
||||
// now set up the events
|
||||
this.setupEvents(xhr, request);
|
||||
// finally send the request
|
||||
if (body) {
|
||||
xhr.send(body);
|
||||
}
|
||||
else {
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
};
|
||||
AjaxSubscriber.prototype.serializeBody = function (body, contentType) {
|
||||
if (!body || typeof body === 'string') {
|
||||
return body;
|
||||
}
|
||||
var splitIndex = contentType.indexOf(';');
|
||||
if (splitIndex !== -1) {
|
||||
contentType = contentType.substring(0, splitIndex);
|
||||
}
|
||||
switch (contentType) {
|
||||
case 'application/x-www-form-urlencoded':
|
||||
return Object.keys(body).map(function (key) { return (key + "=" + encodeURI(body[key])); }).join('&');
|
||||
case 'application/json':
|
||||
return JSON.stringify(body);
|
||||
}
|
||||
};
|
||||
AjaxSubscriber.prototype.setHeaders = function (xhr, headers) {
|
||||
for (var key in headers) {
|
||||
if (headers.hasOwnProperty(key)) {
|
||||
xhr.setRequestHeader(key, headers[key]);
|
||||
}
|
||||
}
|
||||
};
|
||||
AjaxSubscriber.prototype.setupEvents = function (xhr, request) {
|
||||
var progressSubscriber = request.progressSubscriber;
|
||||
xhr.ontimeout = function xhrTimeout(e) {
|
||||
var _a = xhrTimeout, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request;
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.error(e);
|
||||
}
|
||||
subscriber.error(new AjaxTimeoutError(this, request)); //TODO: Make betterer.
|
||||
};
|
||||
xhr.ontimeout.request = request;
|
||||
xhr.ontimeout.subscriber = this;
|
||||
xhr.ontimeout.progressSubscriber = progressSubscriber;
|
||||
if (xhr.upload && 'withCredentials' in xhr && root_1.root.XDomainRequest) {
|
||||
if (progressSubscriber) {
|
||||
xhr.onprogress = function xhrProgress(e) {
|
||||
var progressSubscriber = xhrProgress.progressSubscriber;
|
||||
progressSubscriber.next(e);
|
||||
};
|
||||
xhr.onprogress.progressSubscriber = progressSubscriber;
|
||||
}
|
||||
xhr.onerror = function xhrError(e) {
|
||||
var _a = xhrError, progressSubscriber = _a.progressSubscriber, subscriber = _a.subscriber, request = _a.request;
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.error(e);
|
||||
}
|
||||
subscriber.error(new AjaxError('ajax error', this, request));
|
||||
};
|
||||
xhr.onerror.request = request;
|
||||
xhr.onerror.subscriber = this;
|
||||
xhr.onerror.progressSubscriber = progressSubscriber;
|
||||
}
|
||||
xhr.onreadystatechange = function xhrReadyStateChange(e) {
|
||||
var _a = xhrReadyStateChange, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request;
|
||||
if (this.readyState === 4) {
|
||||
// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
|
||||
var status_1 = this.status === 1223 ? 204 : this.status;
|
||||
var response = (this.responseType === 'text' ? (this.response || this.responseText) : this.response);
|
||||
// fix status code when it is 0 (0 status is undocumented).
|
||||
// Occurs when accessing file resources or on Android 4.1 stock browser
|
||||
// while retrieving files from application cache.
|
||||
if (status_1 === 0) {
|
||||
status_1 = response ? 200 : 0;
|
||||
}
|
||||
if (200 <= status_1 && status_1 < 300) {
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.complete();
|
||||
}
|
||||
subscriber.next(e);
|
||||
subscriber.complete();
|
||||
}
|
||||
else {
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.error(e);
|
||||
}
|
||||
subscriber.error(new AjaxError('ajax error ' + status_1, this, request));
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.onreadystatechange.subscriber = this;
|
||||
xhr.onreadystatechange.progressSubscriber = progressSubscriber;
|
||||
xhr.onreadystatechange.request = request;
|
||||
};
|
||||
AjaxSubscriber.prototype.unsubscribe = function () {
|
||||
var _a = this, done = _a.done, xhr = _a.xhr;
|
||||
if (!done && xhr && xhr.readyState !== 4) {
|
||||
xhr.abort();
|
||||
}
|
||||
_super.prototype.unsubscribe.call(this);
|
||||
};
|
||||
return AjaxSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
exports.AjaxSubscriber = AjaxSubscriber;
|
||||
/** A normalized AJAX response */
|
||||
var AjaxResponse = (function () {
|
||||
function AjaxResponse(originalEvent, xhr, request) {
|
||||
this.originalEvent = originalEvent;
|
||||
this.xhr = xhr;
|
||||
this.request = request;
|
||||
this.status = xhr.status;
|
||||
this.responseType = xhr.responseType;
|
||||
switch (this.responseType) {
|
||||
case 'json':
|
||||
if ('response' in xhr) {
|
||||
this.response = xhr.response;
|
||||
}
|
||||
else {
|
||||
this.response = JSON.parse(xhr.responseText || '');
|
||||
}
|
||||
break;
|
||||
case 'xml':
|
||||
this.response = xhr.responseXML;
|
||||
break;
|
||||
case 'text':
|
||||
default:
|
||||
this.response = ('response' in xhr) ? xhr.response : xhr.responseText;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return AjaxResponse;
|
||||
}());
|
||||
exports.AjaxResponse = AjaxResponse;
|
||||
/** A normalized AJAX error */
|
||||
var AjaxError = (function (_super) {
|
||||
__extends(AjaxError, _super);
|
||||
function AjaxError(message, xhr, request) {
|
||||
_super.call(this, message);
|
||||
this.message = message;
|
||||
this.xhr = xhr;
|
||||
this.request = request;
|
||||
this.status = xhr.status;
|
||||
}
|
||||
return AjaxError;
|
||||
}(Error));
|
||||
exports.AjaxError = AjaxError;
|
||||
var AjaxTimeoutError = (function (_super) {
|
||||
__extends(AjaxTimeoutError, _super);
|
||||
function AjaxTimeoutError(xhr, request) {
|
||||
_super.call(this, 'ajax timeout', xhr, request);
|
||||
}
|
||||
return AjaxTimeoutError;
|
||||
}(AjaxError));
|
||||
exports.AjaxTimeoutError = AjaxTimeoutError;
|
||||
//# sourceMappingURL=AjaxObservable.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AjaxObservable.js","sourceRoot":"","sources":["../../../../src/observable/dom/AjaxObservable.ts"],"names":[],"mappings":";;;;;;AAAA,iBA4YA;AA5YA,qBAAmB,iBAAiB,CAAC,CAAA;AACrC,yBAAuB,qBAAqB,CAAC,CAAA;AAC7C,4BAA0B,wBAAwB,CAAC,CAAA;AACnD,2BAAyB,kBAAkB,CAAC,CAAA;AAC5C,2BAAyB,kBAAkB,CAAC,CAAA;AAoB5C,IAAM,gBAAgB,GAAG;IACvB,IAAI,GAAG,GAAG,IAAI,WAAI,CAAC,cAAc,EAAE,CAAC;IACpC,EAAE,CAAC,CAAC,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QACrB,EAAE,CAAC,CAAC,iBAAiB,IAAI,GAAG,CAAC,CAAC,CAAC;YAC7B,GAAG,CAAC,eAAe,GAAG,IAAI,CAAC;YAC3B,M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,CAAC;QACpC,IAAM,GAAG,GAAmB,mBAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9D,EAAE,CAAC,CAAM,GAAG,KAAK,yBAAW,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,KAAK,CAAC,yBAAW,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YAEf,iBAAiB;YACjB,IAAI,MAAM,SAAK,CAAC;YAChB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,Line truncated
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { Subject } from '../../Subject';
|
||||
import { Subscriber } from '../../Subscriber';
|
||||
import { Observable } from '../../Observable';
|
||||
import { Operator } from '../../Operator';
|
||||
import { Subscription } from '../../Subscription';
|
||||
import { Observer } from '../../Observer';
|
||||
export interface WebSocketSubjectConfig {
|
||||
url: string;
|
||||
protocol?: string | Array<string>;
|
||||
resultSelector?: <T>(e: MessageEvent) => T;
|
||||
openObserver?: Observer<Event>;
|
||||
closeObserver?: Observer<CloseEvent>;
|
||||
closingObserver?: Observer<void>;
|
||||
WebSocketCtor?: {
|
||||
new (url: string, protocol?: string | Array<string>): WebSocket;
|
||||
};
|
||||
}
|
||||
export declare class WebSocketSubject<T> extends Subject<T> {
|
||||
url: string;
|
||||
protocol: string | Array<string>;
|
||||
socket: WebSocket;
|
||||
openObserver: Observer<Event>;
|
||||
closeObserver: Observer<CloseEvent>;
|
||||
closingObserver: Observer<void>;
|
||||
WebSocketCtor: {
|
||||
new (url: string, protocol?: string | Array<string>): WebSocket;
|
||||
};
|
||||
resultSelector(e: MessageEvent): any;
|
||||
static create<T>(urlConfigOrSource: string | WebSocketSubjectConfig): WebSocketSubject<T>;
|
||||
constructor(urlConfigOrSource: string | WebSocketSubjectConfig | Observable<T>, destination?: Observer<T>);
|
||||
lift<R>(operator: Operator<T, R>): WebSocketSubject<T>;
|
||||
multiplex(subMsg: () => any, unsubMsg: () => any, messageFilter: (value: T) => boolean): Observable<{}>;
|
||||
protected _unsubscribe(): void;
|
||||
protected _subscribe(subscriber: Subscriber<T>): Subscription;
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subject_1 = require('../../Subject');
|
||||
var Subscriber_1 = require('../../Subscriber');
|
||||
var Observable_1 = require('../../Observable');
|
||||
var Subscription_1 = require('../../Subscription');
|
||||
var root_1 = require('../../util/root');
|
||||
var ReplaySubject_1 = require('../../subject/ReplaySubject');
|
||||
var tryCatch_1 = require('../../util/tryCatch');
|
||||
var errorObject_1 = require('../../util/errorObject');
|
||||
var assign_1 = require('../../util/assign');
|
||||
var WebSocketSubject = (function (_super) {
|
||||
__extends(WebSocketSubject, _super);
|
||||
function WebSocketSubject(urlConfigOrSource, destination) {
|
||||
if (urlConfigOrSource instanceof Observable_1.Observable) {
|
||||
_super.call(this, destination, urlConfigOrSource);
|
||||
}
|
||||
else {
|
||||
_super.call(this);
|
||||
this.WebSocketCtor = root_1.root.WebSocket;
|
||||
if (typeof urlConfigOrSource === 'string') {
|
||||
this.url = urlConfigOrSource;
|
||||
}
|
||||
else {
|
||||
// WARNING: config object could override important members here.
|
||||
assign_1.assign(this, urlConfigOrSource);
|
||||
}
|
||||
if (!this.WebSocketCtor) {
|
||||
throw new Error('no WebSocket constructor can be found');
|
||||
}
|
||||
this.destination = new ReplaySubject_1.ReplaySubject();
|
||||
}
|
||||
}
|
||||
WebSocketSubject.prototype.resultSelector = function (e) {
|
||||
return JSON.parse(e.data);
|
||||
};
|
||||
WebSocketSubject.create = function (urlConfigOrSource) {
|
||||
return new WebSocketSubject(urlConfigOrSource);
|
||||
};
|
||||
WebSocketSubject.prototype.lift = function (operator) {
|
||||
var sock = new WebSocketSubject(this, this.destination);
|
||||
sock.operator = operator;
|
||||
return sock;
|
||||
};
|
||||
// TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures
|
||||
WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) {
|
||||
var self = this;
|
||||
return new Observable_1.Observable(function (observer) {
|
||||
var result = tryCatch_1.tryCatch(subMsg)();
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
self.next(result);
|
||||
}
|
||||
var subscription = self.subscribe(function (x) {
|
||||
var result = tryCatch_1.tryCatch(messageFilter)(x);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else if (result) {
|
||||
observer.next(x);
|
||||
}
|
||||
}, function (err) { return observer.error(err); }, function () { return observer.complete(); });
|
||||
return function () {
|
||||
var result = tryCatch_1.tryCatch(unsubMsg)();
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
self.next(result);
|
||||
}
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
};
|
||||
WebSocketSubject.prototype._unsubscribe = function () {
|
||||
this.socket = null;
|
||||
this.source = null;
|
||||
this.destination = new ReplaySubject_1.ReplaySubject();
|
||||
this.isStopped = false;
|
||||
this.hasErrored = false;
|
||||
this.hasCompleted = false;
|
||||
this.observers = null;
|
||||
this.isUnsubscribed = false;
|
||||
};
|
||||
WebSocketSubject.prototype._subscribe = function (subscriber) {
|
||||
var _this = this;
|
||||
if (!this.observers) {
|
||||
this.observers = [];
|
||||
}
|
||||
var subscription = _super.prototype._subscribe.call(this, subscriber);
|
||||
// HACK: For some reason transpilation wasn't honoring this in arrow functions below
|
||||
// Doesn't seem right, need to reinvestigate.
|
||||
var self = this;
|
||||
var WebSocket = this.WebSocketCtor;
|
||||
if (self.source || !subscription || subscription.isUnsubscribed) {
|
||||
return subscription;
|
||||
}
|
||||
if (self.url && !self.socket) {
|
||||
var socket_1 = self.protocol ? new WebSocket(self.url, self.protocol) : new WebSocket(self.url);
|
||||
self.socket = socket_1;
|
||||
socket_1.onopen = function (e) {
|
||||
var openObserver = self.openObserver;
|
||||
if (openObserver) {
|
||||
openObserver.next(e);
|
||||
}
|
||||
var queue = self.destination;
|
||||
self.destination = Subscriber_1.Subscriber.create(function (x) { return socket_1.readyState === 1 && socket_1.send(x); }, function (e) {
|
||||
var closingObserver = self.closingObserver;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
if (e && e.code) {
|
||||
socket_1.close(e.code, e.reason);
|
||||
}
|
||||
else {
|
||||
self._finalError(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' +
|
||||
'and an optional reason: { code: number, reason: string }'));
|
||||
}
|
||||
}, function () {
|
||||
var closingObserver = self.closingObserver;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
socket_1.close();
|
||||
});
|
||||
if (queue && queue instanceof ReplaySubject_1.ReplaySubject) {
|
||||
subscription.add(queue.subscribe(self.destination));
|
||||
}
|
||||
};
|
||||
socket_1.onerror = function (e) { return self.error(e); };
|
||||
socket_1.onclose = function (e) {
|
||||
var closeObserver = self.closeObserver;
|
||||
if (closeObserver) {
|
||||
closeObserver.next(e);
|
||||
}
|
||||
if (e.wasClean) {
|
||||
self._finalComplete();
|
||||
}
|
||||
else {
|
||||
self._finalError(e);
|
||||
}
|
||||
};
|
||||
socket_1.onmessage = function (e) {
|
||||
var result = tryCatch_1.tryCatch(self.resultSelector)(e);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
self._finalError(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
self._finalNext(result);
|
||||
}
|
||||
};
|
||||
}
|
||||
return new Subscription_1.Subscription(function () {
|
||||
subscription.unsubscribe();
|
||||
if (!_this.observers || _this.observers.length === 0) {
|
||||
var socket = _this.socket;
|
||||
if (socket && socket.readyState < 2) {
|
||||
socket.close();
|
||||
}
|
||||
_this.socket = undefined;
|
||||
_this.source = undefined;
|
||||
_this.destination = new ReplaySubject_1.ReplaySubject();
|
||||
}
|
||||
});
|
||||
};
|
||||
return WebSocketSubject;
|
||||
}(Subject_1.Subject));
|
||||
exports.WebSocketSubject = WebSocketSubject;
|
||||
//# sourceMappingURL=WebSocketSubject.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"WebSocketSubject.js","sourceRoot":"","sources":["../../../../src/observable/dom/WebSocketSubject.ts"],"names":[],"mappings":";;;;;;AAAA,wBAAsB,eAAe,CAAC,CAAA;AACtC,2BAAyB,kBAAkB,CAAC,CAAA;AAC5C,2BAAyB,kBAAkB,CAAC,CAAA;AAE5C,6BAA2B,oBAAoB,CAAC,CAAA;AAChD,qBAAmB,iBAAiB,CAAC,CAAA;AACrC,8BAA4B,6BAA6B,CAAC,CAAA;AAE1D,yBAAuB,qBAAqB,CAAC,CAAA;AAC7C,4BAA0B,wBAAwB,CAAC,CAAA;AACnD,uBAAqB,mBAAmB,CAAC,CAAA;AAYzC;IAAyC,oCAAU;IAiBjD,0BAAY,iBAAkE,EAAE,WAAyB;QACvG,EAAE,CAAC,CAAC,iBAAiB,YAAY,uBAAU,CAAC,CAAC,CAAC;YAC5C,kBAAM,WAAW,EAAE,iBAAiB,CAAC,CAAC;QACxC,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,iBAAO,CAAC;YACR,IAAI,CAAC,aAAa,GAAG,WAAI,CAAC,SAAS,CAAC;YAEpC,EAAE,CAAC,CAAC,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC;gBAC1C,IAAI,CAAC,GAAG,GAAG,iBAAiB,CAAC;YAC/B,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,gEAAgE;gBAChE,eAAM,CAAC,IAAI,EAA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