mirror of
https://github.com/convergencelabs/monaco-collab-ext.git
synced 2024-10-27 20:34:17 +00:00
84 lines
3.5 KiB
JavaScript
84 lines
3.5 KiB
JavaScript
var editorContents = `var observableProto;
|
|
|
|
/**
|
|
* Represents a push-style collection.
|
|
*/
|
|
var Observable = Rx.Observable = (function () {
|
|
|
|
function makeSubscribe(self, subscribe) {
|
|
return function (o) {
|
|
var oldOnError = o.onError;
|
|
o.onError = function (e) {
|
|
makeStackTraceLong(e, self);
|
|
oldOnError.call(o, e);
|
|
};
|
|
|
|
return subscribe.call(self, o);
|
|
};
|
|
}
|
|
|
|
function Observable() {
|
|
if (Rx.config.longStackSupport && hasStacks) {
|
|
var oldSubscribe = this._subscribe;
|
|
var e = tryCatch(thrower)(new Error()).e;
|
|
this.stack = e.stack.substring(e.stack.indexOf('\\n') + 1);
|
|
this._subscribe = makeSubscribe(this, oldSubscribe);
|
|
}
|
|
}
|
|
|
|
observableProto = Observable.prototype;
|
|
|
|
/**
|
|
* Determines whether the given object is an Observable
|
|
* @param {Any} An object to determine whether it is an Observable
|
|
* @returns {Boolean} true if an Observable, else false.
|
|
*/
|
|
Observable.isObservable = function (o) {
|
|
return o && isFunction(o.subscribe);
|
|
};
|
|
|
|
/**
|
|
* Subscribes an o to the observable sequence.
|
|
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
|
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
|
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
|
|
*/
|
|
observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {
|
|
return this._subscribe(typeof oOrOnNext === 'object' ?
|
|
oOrOnNext :
|
|
observerCreate(oOrOnNext, onError, onCompleted));
|
|
};
|
|
|
|
/**
|
|
* Subscribes to the next value in the sequence with an optional "this" argument.
|
|
* @param {Function} onNext The function to invoke on each element in the observable sequence.
|
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
|
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
|
*/
|
|
observableProto.subscribeOnNext = function (onNext, thisArg) {
|
|
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
|
|
};
|
|
|
|
/**
|
|
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
|
|
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
|
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
|
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
|
*/
|
|
observableProto.subscribeOnError = function (onError, thisArg) {
|
|
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
|
|
};
|
|
|
|
/**
|
|
* Subscribes to the next value in the sequence with an optional "this" argument.
|
|
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
|
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
|
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
|
*/
|
|
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
|
|
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
|
|
};
|
|
|
|
return Observable;
|
|
})();`; |