mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-12 18:56:31 +08:00
8418 lines
340 KiB
JavaScript
8418 lines
340 KiB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||
function __export(m) {
|
||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||
}
|
||
var DEVICE_READY_TIMEOUT = 2000;
|
||
__export(require('./plugins/actionsheet'));
|
||
__export(require('./plugins/ble'));
|
||
__export(require('./plugins/camera'));
|
||
__export(require('./plugins/calendar'));
|
||
__export(require('./plugins/contacts'));
|
||
__export(require('./plugins/device'));
|
||
__export(require('./plugins/facebook'));
|
||
__export(require('./plugins/geolocation'));
|
||
__export(require('./plugins/statusbar'));
|
||
__export(require('./plugins/toast'));
|
||
var before = +new Date;
|
||
var didFireReady = false;
|
||
document.addEventListener('deviceready', function () {
|
||
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
|
||
didFireReady = true;
|
||
});
|
||
setTimeout(function () {
|
||
if (!didFireReady && window.cordova) {
|
||
console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.');
|
||
}
|
||
}, DEVICE_READY_TIMEOUT);
|
||
//# sourceMappingURL=index.js.map
|
||
},{"./plugins/actionsheet":2,"./plugins/ble":3,"./plugins/calendar":4,"./plugins/camera":5,"./plugins/contacts":6,"./plugins/device":7,"./plugins/facebook":8,"./plugins/geolocation":9,"./plugins/statusbar":11,"./plugins/toast":12}],2:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var ActionSheet = (function () {
|
||
function ActionSheet() {
|
||
}
|
||
ActionSheet.show = function (options) { };
|
||
;
|
||
ActionSheet.hide = function (options) { };
|
||
;
|
||
Object.defineProperty(ActionSheet, "show",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], ActionSheet, "show", Object.getOwnPropertyDescriptor(ActionSheet, "show")));
|
||
Object.defineProperty(ActionSheet, "hide",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], ActionSheet, "hide", Object.getOwnPropertyDescriptor(ActionSheet, "hide")));
|
||
ActionSheet = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'ActionSheet',
|
||
plugin: 'cordova-plugin-actionsheet',
|
||
pluginRef: 'plugins.actionsheet',
|
||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet'
|
||
})
|
||
], ActionSheet);
|
||
return ActionSheet;
|
||
})();
|
||
exports.ActionSheet = ActionSheet;
|
||
//# sourceMappingURL=actionsheet.js.map
|
||
},{"./plugin":10}],3:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var BLE = (function () {
|
||
function BLE() {
|
||
}
|
||
BLE.scan = function (services, seconds) { };
|
||
BLE.startScan = function (services) { };
|
||
;
|
||
BLE.stopScan = function () { };
|
||
;
|
||
BLE.connect = function (deviceId) { };
|
||
;
|
||
BLE.disconnect = function (deviceId) { };
|
||
;
|
||
BLE.read = function (deviceId, serviceUUID, characteristicUUID) { };
|
||
;
|
||
BLE.write = function (deviceId, serviceUUID, characteristicUUID, value) { };
|
||
;
|
||
BLE.writeWithoutResponse = function (deviceId, serviceUUID, characteristicUUID, value) { };
|
||
;
|
||
Object.defineProperty(BLE, "scan",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "scan", Object.getOwnPropertyDescriptor(BLE, "scan")));
|
||
Object.defineProperty(BLE, "startScan",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "startScan", Object.getOwnPropertyDescriptor(BLE, "startScan")));
|
||
Object.defineProperty(BLE, "stopScan",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "stopScan", Object.getOwnPropertyDescriptor(BLE, "stopScan")));
|
||
Object.defineProperty(BLE, "connect",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "connect", Object.getOwnPropertyDescriptor(BLE, "connect")));
|
||
Object.defineProperty(BLE, "disconnect",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "disconnect", Object.getOwnPropertyDescriptor(BLE, "disconnect")));
|
||
Object.defineProperty(BLE, "read",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "read", Object.getOwnPropertyDescriptor(BLE, "read")));
|
||
Object.defineProperty(BLE, "write",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "write", Object.getOwnPropertyDescriptor(BLE, "write")));
|
||
Object.defineProperty(BLE, "writeWithoutResponse",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], BLE, "writeWithoutResponse", Object.getOwnPropertyDescriptor(BLE, "writeWithoutResponse")));
|
||
BLE = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'BluetoothLowEnergy',
|
||
plugin: 'cordova-plugin-ble-central',
|
||
pluginRef: 'ble',
|
||
pluginRepo: 'https://github.com/don/cordova-plugin-ble-central'
|
||
})
|
||
], BLE);
|
||
return BLE;
|
||
})();
|
||
exports.BLE = BLE;
|
||
//# sourceMappingURL=ble.js.map
|
||
},{"./plugin":10}],4:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Calendar = (function () {
|
||
function Calendar() {
|
||
}
|
||
Calendar.createCalendar = function (options) { };
|
||
Calendar.deleteCalendar = function (calendarName) { };
|
||
Calendar.getCalendarOptions = function () { };
|
||
Calendar.createEvent = function (title, location, notes, startDate, endDate) { };
|
||
Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) { };
|
||
Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) { };
|
||
Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) { };
|
||
Calendar.createEventInNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { };
|
||
Calendar.findEvent = function (title, location, notes, startDate, endDate) { };
|
||
Calendar.listEventsInRange = function (startDate, endDate) { };
|
||
Calendar.listCalendars = function () { };
|
||
Calendar.findAllEventsInNamedCalendar = function (calendarName) { };
|
||
Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) { };
|
||
Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newEventLocation, newNotes, newStartDate, newEndDate, options) { };
|
||
Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { };
|
||
Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { };
|
||
Calendar.openCalendar = function (date) { };
|
||
Object.defineProperty(Calendar, "createCalendar",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "createCalendar", Object.getOwnPropertyDescriptor(Calendar, "createCalendar")));
|
||
Object.defineProperty(Calendar, "deleteCalendar",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "deleteCalendar", Object.getOwnPropertyDescriptor(Calendar, "deleteCalendar")));
|
||
Object.defineProperty(Calendar, "getCalendarOptions",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "getCalendarOptions", Object.getOwnPropertyDescriptor(Calendar, "getCalendarOptions")));
|
||
Object.defineProperty(Calendar, "createEvent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "createEvent", Object.getOwnPropertyDescriptor(Calendar, "createEvent")));
|
||
Object.defineProperty(Calendar, "createEventWithOptions",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "createEventWithOptions", Object.getOwnPropertyDescriptor(Calendar, "createEventWithOptions")));
|
||
Object.defineProperty(Calendar, "createEventInteractively",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "createEventInteractively", Object.getOwnPropertyDescriptor(Calendar, "createEventInteractively")));
|
||
Object.defineProperty(Calendar, "createEventInteractivelyWithOptions",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "createEventInteractivelyWithOptions", Object.getOwnPropertyDescriptor(Calendar, "createEventInteractivelyWithOptions")));
|
||
Object.defineProperty(Calendar, "createEventInNamedCalendar",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "createEventInNamedCalendar", Object.getOwnPropertyDescriptor(Calendar, "createEventInNamedCalendar")));
|
||
Object.defineProperty(Calendar, "findEvent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "findEvent", Object.getOwnPropertyDescriptor(Calendar, "findEvent")));
|
||
Object.defineProperty(Calendar, "listEventsInRange",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "listEventsInRange", Object.getOwnPropertyDescriptor(Calendar, "listEventsInRange")));
|
||
Object.defineProperty(Calendar, "listCalendars",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "listCalendars", Object.getOwnPropertyDescriptor(Calendar, "listCalendars")));
|
||
Object.defineProperty(Calendar, "findAllEventsInNamedCalendar",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "findAllEventsInNamedCalendar", Object.getOwnPropertyDescriptor(Calendar, "findAllEventsInNamedCalendar")));
|
||
Object.defineProperty(Calendar, "modifyEvent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "modifyEvent", Object.getOwnPropertyDescriptor(Calendar, "modifyEvent")));
|
||
Object.defineProperty(Calendar, "modifyEventWithOptions",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "modifyEventWithOptions", Object.getOwnPropertyDescriptor(Calendar, "modifyEventWithOptions")));
|
||
Object.defineProperty(Calendar, "deleteEvent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "deleteEvent", Object.getOwnPropertyDescriptor(Calendar, "deleteEvent")));
|
||
Object.defineProperty(Calendar, "deleteEventFromNamedCalendar",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "deleteEventFromNamedCalendar", Object.getOwnPropertyDescriptor(Calendar, "deleteEventFromNamedCalendar")));
|
||
Object.defineProperty(Calendar, "openCalendar",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Calendar, "openCalendar", Object.getOwnPropertyDescriptor(Calendar, "openCalendar")));
|
||
Calendar = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Calendar',
|
||
plugin: 'cordova-plugin-calendar',
|
||
pluginRef: 'plugins.calendar'
|
||
})
|
||
], Calendar);
|
||
return Calendar;
|
||
})();
|
||
exports.Calendar = Calendar;
|
||
//# sourceMappingURL=calendar.js.map
|
||
},{"./plugin":10}],5:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Camera = (function () {
|
||
function Camera() {
|
||
}
|
||
Camera.getPicture = function (options) { };
|
||
;
|
||
Camera.cleanup = function () { };
|
||
;
|
||
Object.defineProperty(Camera, "getPicture",
|
||
__decorate([
|
||
plugin_1.Cordova({
|
||
// Not sure why this plugin has the success/err come first...
|
||
callbackOrder: 'reverse'
|
||
})
|
||
], Camera, "getPicture", Object.getOwnPropertyDescriptor(Camera, "getPicture")));
|
||
Object.defineProperty(Camera, "cleanup",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Camera, "cleanup", Object.getOwnPropertyDescriptor(Camera, "cleanup")));
|
||
Camera = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Camera',
|
||
plugin: 'cordova-plugin-camera',
|
||
pluginRef: 'navigator.camera'
|
||
})
|
||
], Camera);
|
||
return Camera;
|
||
})();
|
||
exports.Camera = Camera;
|
||
//# sourceMappingURL=camera.js.map
|
||
},{"./plugin":10}],6:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Contacts = (function () {
|
||
function Contacts() {
|
||
}
|
||
Contacts.create = function (fields, options) { };
|
||
;
|
||
Contacts.find = function (fields, options) { };
|
||
;
|
||
Contacts.pickContact = function () { };
|
||
;
|
||
Object.defineProperty(Contacts, "create",
|
||
__decorate([
|
||
plugin_1.Cordova({
|
||
successIndex: 1,
|
||
errorIndex: 2
|
||
})
|
||
], Contacts, "create", Object.getOwnPropertyDescriptor(Contacts, "create")));
|
||
Object.defineProperty(Contacts, "find",
|
||
__decorate([
|
||
plugin_1.Cordova({
|
||
successIndex: 1,
|
||
errorIndex: 2
|
||
})
|
||
], Contacts, "find", Object.getOwnPropertyDescriptor(Contacts, "find")));
|
||
Object.defineProperty(Contacts, "pickContact",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Contacts, "pickContact", Object.getOwnPropertyDescriptor(Contacts, "pickContact")));
|
||
Contacts = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Contacts',
|
||
plugin: 'cordova-plugin-contacts',
|
||
pluginRef: 'navigator.contacts',
|
||
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||
})
|
||
], Contacts);
|
||
return Contacts;
|
||
})();
|
||
exports.Contacts = Contacts;
|
||
//# sourceMappingURL=contacts.js.map
|
||
},{"./plugin":10}],7:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Device = (function () {
|
||
function Device() {
|
||
}
|
||
Device.getDevice = function () {
|
||
return window.device;
|
||
};
|
||
Object.defineProperty(Device, "getDevice",
|
||
__decorate([
|
||
plugin_1.RequiresPlugin
|
||
], Device, "getDevice", Object.getOwnPropertyDescriptor(Device, "getDevice")));
|
||
Device = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Device',
|
||
plugin: 'cordova-plugin-device',
|
||
pluginRef: 'device'
|
||
})
|
||
], Device);
|
||
return Device;
|
||
})();
|
||
exports.Device = Device;
|
||
//# sourceMappingURL=device.js.map
|
||
},{"./plugin":10}],8:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Facebook = (function () {
|
||
function Facebook() {
|
||
}
|
||
Facebook.login = function (permissions) { };
|
||
Facebook.logout = function () { };
|
||
Facebook.getLoginStatus = function () { };
|
||
Facebook.getAccessToken = function () { };
|
||
Facebook.showDialog = function (options) { };
|
||
Facebook.api = function (requestPath, permissions) { };
|
||
Facebook.logEvent = function (name, params, valueToSum) { };
|
||
Facebook.logPurchase = function (value, currency) { };
|
||
Facebook.appInvite = function (options) { };
|
||
Object.defineProperty(Facebook, "login",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "login", Object.getOwnPropertyDescriptor(Facebook, "login")));
|
||
Object.defineProperty(Facebook, "logout",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "logout", Object.getOwnPropertyDescriptor(Facebook, "logout")));
|
||
Object.defineProperty(Facebook, "getLoginStatus",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "getLoginStatus", Object.getOwnPropertyDescriptor(Facebook, "getLoginStatus")));
|
||
Object.defineProperty(Facebook, "getAccessToken",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "getAccessToken", Object.getOwnPropertyDescriptor(Facebook, "getAccessToken")));
|
||
Object.defineProperty(Facebook, "showDialog",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "showDialog", Object.getOwnPropertyDescriptor(Facebook, "showDialog")));
|
||
Object.defineProperty(Facebook, "api",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "api", Object.getOwnPropertyDescriptor(Facebook, "api")));
|
||
Object.defineProperty(Facebook, "logEvent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "logEvent", Object.getOwnPropertyDescriptor(Facebook, "logEvent")));
|
||
Object.defineProperty(Facebook, "logPurchase",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "logPurchase", Object.getOwnPropertyDescriptor(Facebook, "logPurchase")));
|
||
Object.defineProperty(Facebook, "appInvite",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Facebook, "appInvite", Object.getOwnPropertyDescriptor(Facebook, "appInvite")));
|
||
Facebook = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Facebook',
|
||
plugin: 'cordova-plugin-facebook4',
|
||
pluginRef: 'facebookConnectPlugin'
|
||
})
|
||
], Facebook);
|
||
return Facebook;
|
||
})();
|
||
exports.Facebook = Facebook;
|
||
//# sourceMappingURL=facebook.js.map
|
||
},{"./plugin":10}],9:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Geolocation = (function () {
|
||
function Geolocation() {
|
||
}
|
||
Geolocation.getCurrentPosition = function (options) { };
|
||
;
|
||
Geolocation.watchPosition = function (options) { };
|
||
;
|
||
Object.defineProperty(Geolocation, "getCurrentPosition",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Geolocation, "getCurrentPosition", Object.getOwnPropertyDescriptor(Geolocation, "getCurrentPosition")));
|
||
Object.defineProperty(Geolocation, "watchPosition",
|
||
__decorate([
|
||
plugin_1.Cordova({
|
||
callbackOrder: 'reverse',
|
||
observable: true,
|
||
clearFunction: 'clearWatch()'
|
||
})
|
||
], Geolocation, "watchPosition", Object.getOwnPropertyDescriptor(Geolocation, "watchPosition")));
|
||
Geolocation = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Geolocation',
|
||
plugin: 'cordova-plugin-geolocation',
|
||
pluginRef: 'navigator.geolocation'
|
||
})
|
||
], Geolocation);
|
||
return Geolocation;
|
||
})();
|
||
exports.Geolocation = Geolocation;
|
||
//# sourceMappingURL=geolocation.js.map
|
||
},{"./plugin":10}],10:[function(require,module,exports){
|
||
var util_1 = require('../util');
|
||
var Rx_1 = require('@reactivex/rxjs/dist/cjs/Rx');
|
||
exports.getPlugin = function (pluginRef) {
|
||
return util_1.get(window, pluginRef);
|
||
};
|
||
exports.isInstalled = function (pluginRef) {
|
||
return !!exports.getPlugin(pluginRef);
|
||
};
|
||
exports.pluginWarn = function (pluginName, method, plugin) {
|
||
if (method) {
|
||
console.warn('Native: tried calling ' + pluginName + '.' + method +
|
||
', but the ' + pluginName + ' plugin is not installed. Install the ' +
|
||
plugin + ' plugin');
|
||
}
|
||
else {
|
||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed. Install the ' + plugin + ' plugin');
|
||
}
|
||
};
|
||
exports.cordovaWarn = function (pluginName, method) {
|
||
if (method) {
|
||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||
}
|
||
else {
|
||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||
}
|
||
};
|
||
function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
|
||
// Try to figure out where the success/error callbacks need to be bound
|
||
// to our promise resolve/reject handlers.
|
||
if (opts === void 0) { opts = {}; }
|
||
// If the plugin method expects myMethod(success, err, options)
|
||
if (opts.callbackOrder == 'reverse') {
|
||
// Get those arguments in the order [reject, resolve, ...restOfArgs]
|
||
args.unshift(reject);
|
||
args.unshift(resolve);
|
||
}
|
||
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||
// If we've specified a success/error index
|
||
args.splice(opts.successIndex, 0, resolve);
|
||
args.splice(opts.errorIndex, 0, reject);
|
||
}
|
||
else {
|
||
// Otherwise, let's tack them on to the end of the argument list
|
||
// which is 90% of cases
|
||
args.push(resolve);
|
||
args.push(reject);
|
||
}
|
||
var pluginInstance = exports.getPlugin(pluginObj.pluginRef);
|
||
if (!pluginInstance) {
|
||
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
|
||
if (!window.cordova) {
|
||
exports.cordovaWarn(pluginObj.name, methodName);
|
||
reject({
|
||
error: 'cordova_not_available'
|
||
});
|
||
return;
|
||
}
|
||
exports.pluginWarn(pluginObj.name, methodName, pluginObj.name);
|
||
reject({
|
||
error: 'plugin_not_installed'
|
||
});
|
||
return;
|
||
}
|
||
console.log('Cordova calling', pluginObj.name, methodName, args);
|
||
// TODO: Illegal invocation needs window context
|
||
return util_1.get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
|
||
}
|
||
function wrapPromise(pluginObj, methodName, args, opts) {
|
||
if (opts === void 0) { opts = {}; }
|
||
return new Promise(function (resolve, reject) {
|
||
callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||
});
|
||
}
|
||
function wrapObservable(pluginObj, methodName, args, opts) {
|
||
if (opts === void 0) { opts = {}; }
|
||
return new Rx_1.Observable(function (observer) {
|
||
var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||
return function () {
|
||
try {
|
||
return util_1.get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, pluginResult);
|
||
}
|
||
catch (e) {
|
||
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
|
||
console.log(e);
|
||
}
|
||
};
|
||
});
|
||
}
|
||
exports.wrap = function (pluginObj, methodName, opts) {
|
||
if (opts === void 0) { opts = {}; }
|
||
return function () {
|
||
var args = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
args[_i - 0] = arguments[_i];
|
||
}
|
||
if (opts.observable) {
|
||
return wrapObservable(pluginObj, methodName, args, opts);
|
||
}
|
||
else {
|
||
return wrapPromise(pluginObj, methodName, args, opts);
|
||
}
|
||
};
|
||
};
|
||
/**
|
||
* Class decorator specifying Plugin metadata. Required for all plugins.
|
||
*/
|
||
function Plugin(config) {
|
||
return function (cls) {
|
||
// Add these fields to the class
|
||
for (var k in config) {
|
||
cls[k] = config[k];
|
||
}
|
||
return cls;
|
||
};
|
||
}
|
||
exports.Plugin = Plugin;
|
||
/**
|
||
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
|
||
* and the required plugin are installed.
|
||
*/
|
||
function Cordova(opts) {
|
||
if (opts === void 0) { opts = {}; }
|
||
return function (target, methodName, descriptor) {
|
||
var originalMethod = descriptor.value;
|
||
return {
|
||
value: function () {
|
||
var args = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
args[_i - 0] = arguments[_i];
|
||
}
|
||
return exports.wrap(this, methodName, opts).apply(this, args);
|
||
}
|
||
};
|
||
};
|
||
}
|
||
exports.Cordova = Cordova;
|
||
/**
|
||
* Before calling the original method, ensure Cordova and the plugin are installed.
|
||
*/
|
||
function RequiresPlugin(target, key, descriptor) {
|
||
var originalMethod = descriptor.value;
|
||
descriptor.value = function () {
|
||
var args = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
args[_i - 0] = arguments[_i];
|
||
}
|
||
console.log('Calling', this);
|
||
if (!window.cordova) {
|
||
exports.cordovaWarn(this.name, null);
|
||
return;
|
||
}
|
||
var pluginInstance = exports.getPlugin(this.pluginRef);
|
||
if (!pluginInstance) {
|
||
exports.pluginWarn(this.name, null, this.name);
|
||
return;
|
||
}
|
||
originalMethod.apply(this, args);
|
||
};
|
||
return descriptor;
|
||
}
|
||
exports.RequiresPlugin = RequiresPlugin;
|
||
//# sourceMappingURL=plugin.js.map
|
||
},{"../util":13,"@reactivex/rxjs/dist/cjs/Rx":18}],11:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var StatusBar = (function () {
|
||
function StatusBar() {
|
||
}
|
||
StatusBar.overlaysWebView = function (doOverlay) { };
|
||
;
|
||
StatusBar.styleDefault = function () { };
|
||
;
|
||
StatusBar.styleLightContent = function () { };
|
||
;
|
||
StatusBar.styleBlackTranslucent = function () { };
|
||
;
|
||
StatusBar.styleBlackOpaque = function () { };
|
||
;
|
||
StatusBar.backgroundColorByName = function (colorName) { };
|
||
;
|
||
StatusBar.backgroundColorByHexString = function (hexString) { };
|
||
;
|
||
StatusBar.hide = function () { };
|
||
;
|
||
StatusBar.show = function () { };
|
||
;
|
||
Object.defineProperty(StatusBar, "overlaysWebView",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "overlaysWebView", Object.getOwnPropertyDescriptor(StatusBar, "overlaysWebView")));
|
||
Object.defineProperty(StatusBar, "styleDefault",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "styleDefault", Object.getOwnPropertyDescriptor(StatusBar, "styleDefault")));
|
||
Object.defineProperty(StatusBar, "styleLightContent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "styleLightContent", Object.getOwnPropertyDescriptor(StatusBar, "styleLightContent")));
|
||
Object.defineProperty(StatusBar, "styleBlackTranslucent",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "styleBlackTranslucent", Object.getOwnPropertyDescriptor(StatusBar, "styleBlackTranslucent")));
|
||
Object.defineProperty(StatusBar, "styleBlackOpaque",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "styleBlackOpaque", Object.getOwnPropertyDescriptor(StatusBar, "styleBlackOpaque")));
|
||
Object.defineProperty(StatusBar, "backgroundColorByName",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "backgroundColorByName", Object.getOwnPropertyDescriptor(StatusBar, "backgroundColorByName")));
|
||
Object.defineProperty(StatusBar, "backgroundColorByHexString",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "backgroundColorByHexString", Object.getOwnPropertyDescriptor(StatusBar, "backgroundColorByHexString")));
|
||
Object.defineProperty(StatusBar, "hide",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "hide", Object.getOwnPropertyDescriptor(StatusBar, "hide")));
|
||
Object.defineProperty(StatusBar, "show",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], StatusBar, "show", Object.getOwnPropertyDescriptor(StatusBar, "show")));
|
||
StatusBar = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'StatusBar',
|
||
plugin: 'cordova-plugin-statusbar',
|
||
pluginRef: 'StatusBar'
|
||
})
|
||
], StatusBar);
|
||
return StatusBar;
|
||
})();
|
||
exports.StatusBar = StatusBar;
|
||
//# sourceMappingURL=statusbar.js.map
|
||
},{"./plugin":10}],12:[function(require,module,exports){
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||
switch (arguments.length) {
|
||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||
}
|
||
};
|
||
var plugin_1 = require('./plugin');
|
||
var Toast = (function () {
|
||
function Toast() {
|
||
}
|
||
Toast.hide = function () { };
|
||
;
|
||
Toast.showWithOptions = function (options) { };
|
||
;
|
||
Object.defineProperty(Toast, "hide",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Toast, "hide", Object.getOwnPropertyDescriptor(Toast, "hide")));
|
||
Object.defineProperty(Toast, "showWithOptions",
|
||
__decorate([
|
||
plugin_1.Cordova()
|
||
], Toast, "showWithOptions", Object.getOwnPropertyDescriptor(Toast, "showWithOptions")));
|
||
Toast = __decorate([
|
||
plugin_1.Plugin({
|
||
name: 'Toast',
|
||
plugin: 'cordova-plugin-x-toast',
|
||
pluginRef: 'plugins.toast',
|
||
repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin'
|
||
})
|
||
], Toast);
|
||
return Toast;
|
||
})();
|
||
exports.Toast = Toast;
|
||
//# sourceMappingURL=toast.js.map
|
||
},{"./plugin":10}],13:[function(require,module,exports){
|
||
function get(obj, path) {
|
||
for (var i = 0, path = path.split('.'), len = path.length; i < len; i++) {
|
||
if (!obj) {
|
||
return null;
|
||
}
|
||
obj = obj[path[i]];
|
||
}
|
||
return obj;
|
||
}
|
||
exports.get = get;
|
||
;
|
||
//# sourceMappingURL=util.js.map
|
||
},{}],14:[function(require,module,exports){
|
||
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 Subscriber_1 = require('./Subscriber');
|
||
var InnerSubscriber = (function (_super) {
|
||
__extends(InnerSubscriber, _super);
|
||
function InnerSubscriber(parent, outerValue, outerIndex) {
|
||
_super.call(this);
|
||
this.parent = parent;
|
||
this.outerValue = outerValue;
|
||
this.outerIndex = outerIndex;
|
||
this.index = 0;
|
||
}
|
||
InnerSubscriber.prototype._next = function (value) {
|
||
var index = this.index++;
|
||
this.parent.notifyNext(this.outerValue, value, this.outerIndex, index);
|
||
};
|
||
InnerSubscriber.prototype._error = function (error) {
|
||
this.parent.notifyError(error, this);
|
||
};
|
||
InnerSubscriber.prototype._complete = function () {
|
||
this.parent.notifyComplete(this);
|
||
};
|
||
return InnerSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
exports.InnerSubscriber = InnerSubscriber;
|
||
//# sourceMappingURL=InnerSubscriber.js.map
|
||
},{"./Subscriber":20}],15:[function(require,module,exports){
|
||
var Observable_1 = require('./Observable');
|
||
var Notification = (function () {
|
||
function Notification(kind, value, exception) {
|
||
this.kind = kind;
|
||
this.value = value;
|
||
this.exception = exception;
|
||
this.hasValue = kind === 'N';
|
||
}
|
||
Notification.prototype.observe = function (observer) {
|
||
switch (this.kind) {
|
||
case 'N':
|
||
return observer.next(this.value);
|
||
case 'E':
|
||
return observer.error(this.exception);
|
||
case 'C':
|
||
return observer.complete();
|
||
}
|
||
};
|
||
Notification.prototype.do = function (next, error, complete) {
|
||
var kind = this.kind;
|
||
switch (kind) {
|
||
case 'N':
|
||
return next(this.value);
|
||
case 'E':
|
||
return error(this.exception);
|
||
case 'C':
|
||
return complete();
|
||
}
|
||
};
|
||
Notification.prototype.accept = function (nextOrObserver, error, complete) {
|
||
if (nextOrObserver && typeof nextOrObserver.next === 'function') {
|
||
return this.observe(nextOrObserver);
|
||
}
|
||
else {
|
||
return this.do(nextOrObserver, error, complete);
|
||
}
|
||
};
|
||
Notification.prototype.toObservable = function () {
|
||
var kind = this.kind;
|
||
switch (kind) {
|
||
case 'N':
|
||
return Observable_1.Observable.of(this.value);
|
||
case 'E':
|
||
return Observable_1.Observable.throw(this.exception);
|
||
case 'C':
|
||
return Observable_1.Observable.empty();
|
||
}
|
||
};
|
||
Notification.createNext = function (value) {
|
||
if (typeof value !== 'undefined') {
|
||
return new Notification('N', value);
|
||
}
|
||
return this.undefinedValueNotification;
|
||
};
|
||
Notification.createError = function (err) {
|
||
return new Notification('E', undefined, err);
|
||
};
|
||
Notification.createComplete = function () {
|
||
return this.completeNotification;
|
||
};
|
||
Notification.completeNotification = new Notification('C');
|
||
Notification.undefinedValueNotification = new Notification('N', undefined);
|
||
return Notification;
|
||
})();
|
||
exports.Notification = Notification;
|
||
//# sourceMappingURL=Notification.js.map
|
||
},{"./Observable":16}],16:[function(require,module,exports){
|
||
var Subscriber_1 = require('./Subscriber');
|
||
var root_1 = require('./util/root');
|
||
var Symbol_observable_1 = require('./util/Symbol_observable');
|
||
/**
|
||
* A representation of any set of values over any amount of time. This the most basic building block
|
||
* of RxJS.
|
||
*
|
||
* @class Observable<T>
|
||
*/
|
||
var Observable = (function () {
|
||
/**
|
||
* @constructor
|
||
* @param {Function} subscribe the function that is
|
||
* called when the Observable is initially subscribed to. This function is given a Subscriber, to which new values
|
||
* can be `next`ed, or an `error` method can be called to raise an error, or `complete` can be called to notify
|
||
* of a successful completion.
|
||
*/
|
||
function Observable(subscribe) {
|
||
this._isScalar = false;
|
||
if (subscribe) {
|
||
this._subscribe = subscribe;
|
||
}
|
||
}
|
||
/**
|
||
* @method lift
|
||
* @param {Operator} operator the operator defining the operation to take on the observable
|
||
* @returns {Observable} a new observable with the Operator applied
|
||
* @description creates a new Observable, with this Observable as the source, and the passed
|
||
* operator defined as the new observable's operator.
|
||
*/
|
||
Observable.prototype.lift = function (operator) {
|
||
var observable = new Observable();
|
||
observable.source = this;
|
||
observable.operator = operator;
|
||
return observable;
|
||
};
|
||
/**
|
||
* @method Symbol.observable
|
||
* @returns {Observable} this instance of the observable
|
||
* @description an interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable
|
||
*/
|
||
Observable.prototype[Symbol_observable_1.$$observable] = function () {
|
||
return this;
|
||
};
|
||
/**
|
||
* @method subscribe
|
||
* @param {Observer|Function} observerOrNext (optional) either an observer defining all functions to be called,
|
||
* or the first of three possible handlers, which is the handler for each value emitted from the observable.
|
||
* @param {Function} error (optional) a handler for a terminal event resulting from an error. If no error handler is provided,
|
||
* the error will be thrown as unhandled
|
||
* @param {Function} complete (optional) a handler for a terminal event resulting from successful completion.
|
||
* @returns {Subscription} a subscription reference to the registered handlers
|
||
* @description registers handlers for handling emitted values, error and completions from the observable, and
|
||
* executes the observable's subscriber function, which will take action to set up the underlying data stream
|
||
*/
|
||
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
||
var subscriber;
|
||
if (observerOrNext && typeof observerOrNext === 'object') {
|
||
if (observerOrNext instanceof Subscriber_1.Subscriber) {
|
||
subscriber = observerOrNext;
|
||
}
|
||
else {
|
||
subscriber = new Subscriber_1.Subscriber(observerOrNext);
|
||
}
|
||
}
|
||
else {
|
||
var next = observerOrNext;
|
||
subscriber = Subscriber_1.Subscriber.create(next, error, complete);
|
||
}
|
||
subscriber.add(this._subscribe(subscriber));
|
||
return subscriber;
|
||
};
|
||
/**
|
||
* @method forEach
|
||
* @param {Function} next a handler for each value emitted by the observable
|
||
* @param {PromiseConstructor} PromiseCtor? a constructor function used to instantiate the Promise
|
||
* @returns {Promise} a promise that either resolves on observable completion or
|
||
* rejects with the handled error
|
||
*/
|
||
Observable.prototype.forEach = function (next, PromiseCtor) {
|
||
var _this = this;
|
||
if (!PromiseCtor) {
|
||
if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
|
||
PromiseCtor = root_1.root.Rx.config.Promise;
|
||
}
|
||
else if (root_1.root.Promise) {
|
||
PromiseCtor = root_1.root.Promise;
|
||
}
|
||
}
|
||
if (!PromiseCtor) {
|
||
throw new Error('no Promise impl found');
|
||
}
|
||
return new PromiseCtor(function (resolve, reject) {
|
||
_this.subscribe(next, reject, resolve);
|
||
});
|
||
};
|
||
Observable.prototype._subscribe = function (subscriber) {
|
||
return this.source._subscribe(this.operator.call(subscriber));
|
||
};
|
||
// HACK: Since TypeScript inherits static properties too, we have to
|
||
// fight against TypeScript here so Subject can have a different static create signature
|
||
/**
|
||
* @static
|
||
* @method create
|
||
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
|
||
* @returns {Observable} a new cold observable
|
||
* @description creates a new cold Observable by calling the Observable constructor
|
||
*/
|
||
Observable.create = function (subscribe) {
|
||
return new Observable(subscribe);
|
||
};
|
||
return Observable;
|
||
})();
|
||
exports.Observable = Observable;
|
||
//# sourceMappingURL=Observable.js.map
|
||
},{"./Subscriber":20,"./util/Symbol_observable":141,"./util/root":149}],17:[function(require,module,exports){
|
||
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 Subscriber_1 = require('./Subscriber');
|
||
var OuterSubscriber = (function (_super) {
|
||
__extends(OuterSubscriber, _super);
|
||
function OuterSubscriber() {
|
||
_super.apply(this, arguments);
|
||
}
|
||
OuterSubscriber.prototype.notifyComplete = function (inner) {
|
||
this.destination.complete();
|
||
};
|
||
OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
this.destination.next(innerValue);
|
||
};
|
||
OuterSubscriber.prototype.notifyError = function (error, inner) {
|
||
this.destination.error(error);
|
||
};
|
||
return OuterSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
exports.OuterSubscriber = OuterSubscriber;
|
||
//# sourceMappingURL=OuterSubscriber.js.map
|
||
},{"./Subscriber":20}],18:[function(require,module,exports){
|
||
var Observable_1 = require('./Observable');
|
||
exports.Observable = Observable_1.Observable;
|
||
// operators
|
||
/* tslint:disable:no-use-before-declare */
|
||
var combineLatest_static_1 = require('./operators/combineLatest-static');
|
||
Observable_1.Observable.combineLatest = combineLatest_static_1.combineLatest;
|
||
var concat_static_1 = require('./operators/concat-static');
|
||
Observable_1.Observable.concat = concat_static_1.concat;
|
||
var merge_static_1 = require('./operators/merge-static');
|
||
Observable_1.Observable.merge = merge_static_1.merge;
|
||
/* tslint:enable:no-use-before-declare */
|
||
var DeferObservable_1 = require('./observables/DeferObservable');
|
||
Observable_1.Observable.defer = DeferObservable_1.DeferObservable.create;
|
||
var EmptyObservable_1 = require('./observables/EmptyObservable');
|
||
Observable_1.Observable.empty = EmptyObservable_1.EmptyObservable.create;
|
||
var ForkJoinObservable_1 = require('./observables/ForkJoinObservable');
|
||
Observable_1.Observable.forkJoin = ForkJoinObservable_1.ForkJoinObservable.create;
|
||
var FromObservable_1 = require('./observables/FromObservable');
|
||
Observable_1.Observable.from = FromObservable_1.FromObservable.create;
|
||
var ArrayObservable_1 = require('./observables/ArrayObservable');
|
||
Observable_1.Observable.fromArray = ArrayObservable_1.ArrayObservable.create;
|
||
var FromEventObservable_1 = require('./observables/FromEventObservable');
|
||
Observable_1.Observable.fromEvent = FromEventObservable_1.FromEventObservable.create;
|
||
var FromEventPatternObservable_1 = require('./observables/FromEventPatternObservable');
|
||
Observable_1.Observable.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create;
|
||
var PromiseObservable_1 = require('./observables/PromiseObservable');
|
||
Observable_1.Observable.fromPromise = PromiseObservable_1.PromiseObservable.create;
|
||
var IntervalObservable_1 = require('./observables/IntervalObservable');
|
||
Observable_1.Observable.interval = IntervalObservable_1.IntervalObservable.create;
|
||
var InfiniteObservable_1 = require('./observables/InfiniteObservable');
|
||
Observable_1.Observable.never = InfiniteObservable_1.InfiniteObservable.create;
|
||
Observable_1.Observable.of = ArrayObservable_1.ArrayObservable.of;
|
||
var RangeObservable_1 = require('./observables/RangeObservable');
|
||
Observable_1.Observable.range = RangeObservable_1.RangeObservable.create;
|
||
var ErrorObservable_1 = require('./observables/ErrorObservable');
|
||
Observable_1.Observable.throw = ErrorObservable_1.ErrorObservable.create;
|
||
var TimerObservable_1 = require('./observables/TimerObservable');
|
||
Observable_1.Observable.timer = TimerObservable_1.TimerObservable.create;
|
||
var zip_static_1 = require('./operators/zip-static');
|
||
Observable_1.Observable.zip = zip_static_1.zip;
|
||
var observableProto = Observable_1.Observable.prototype;
|
||
var buffer_1 = require('./operators/buffer');
|
||
observableProto.buffer = buffer_1.buffer;
|
||
var bufferCount_1 = require('./operators/bufferCount');
|
||
observableProto.bufferCount = bufferCount_1.bufferCount;
|
||
var bufferTime_1 = require('./operators/bufferTime');
|
||
observableProto.bufferTime = bufferTime_1.bufferTime;
|
||
var bufferToggle_1 = require('./operators/bufferToggle');
|
||
observableProto.bufferToggle = bufferToggle_1.bufferToggle;
|
||
var bufferWhen_1 = require('./operators/bufferWhen');
|
||
observableProto.bufferWhen = bufferWhen_1.bufferWhen;
|
||
var catch_1 = require('./operators/catch');
|
||
observableProto.catch = catch_1._catch;
|
||
var combineAll_1 = require('./operators/combineAll');
|
||
observableProto.combineAll = combineAll_1.combineAll;
|
||
var combineLatest_1 = require('./operators/combineLatest');
|
||
observableProto.combineLatest = combineLatest_1.combineLatest;
|
||
var concat_1 = require('./operators/concat');
|
||
observableProto.concat = concat_1.concat;
|
||
var concatAll_1 = require('./operators/concatAll');
|
||
observableProto.concatAll = concatAll_1.concatAll;
|
||
var concatMap_1 = require('./operators/concatMap');
|
||
observableProto.concatMap = concatMap_1.concatMap;
|
||
var concatMapTo_1 = require('./operators/concatMapTo');
|
||
observableProto.concatMapTo = concatMapTo_1.concatMapTo;
|
||
var count_1 = require('./operators/count');
|
||
observableProto.count = count_1.count;
|
||
var dematerialize_1 = require('./operators/dematerialize');
|
||
observableProto.dematerialize = dematerialize_1.dematerialize;
|
||
var debounce_1 = require('./operators/debounce');
|
||
observableProto.debounce = debounce_1.debounce;
|
||
var debounceTime_1 = require('./operators/debounceTime');
|
||
observableProto.debounceTime = debounceTime_1.debounceTime;
|
||
var defaultIfEmpty_1 = require('./operators/defaultIfEmpty');
|
||
observableProto.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty;
|
||
var delay_1 = require('./operators/delay');
|
||
observableProto.delay = delay_1.delay;
|
||
var distinctUntilChanged_1 = require('./operators/distinctUntilChanged');
|
||
observableProto.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged;
|
||
var do_1 = require('./operators/do');
|
||
observableProto.do = do_1._do;
|
||
var expand_1 = require('./operators/expand');
|
||
observableProto.expand = expand_1.expand;
|
||
var filter_1 = require('./operators/filter');
|
||
observableProto.filter = filter_1.filter;
|
||
var finally_1 = require('./operators/finally');
|
||
observableProto.finally = finally_1._finally;
|
||
var first_1 = require('./operators/first');
|
||
observableProto.first = first_1.first;
|
||
var groupBy_1 = require('./operators/groupBy');
|
||
observableProto.groupBy = groupBy_1.groupBy;
|
||
var ignoreElements_1 = require('./operators/ignoreElements');
|
||
observableProto.ignoreElements = ignoreElements_1.ignoreElements;
|
||
var every_1 = require('./operators/every');
|
||
observableProto.every = every_1.every;
|
||
var last_1 = require('./operators/last');
|
||
observableProto.last = last_1.last;
|
||
var map_1 = require('./operators/map');
|
||
observableProto.map = map_1.map;
|
||
var mapTo_1 = require('./operators/mapTo');
|
||
observableProto.mapTo = mapTo_1.mapTo;
|
||
var materialize_1 = require('./operators/materialize');
|
||
observableProto.materialize = materialize_1.materialize;
|
||
var merge_1 = require('./operators/merge');
|
||
observableProto.merge = merge_1.merge;
|
||
var mergeAll_1 = require('./operators/mergeAll');
|
||
observableProto.mergeAll = mergeAll_1.mergeAll;
|
||
var mergeMap_1 = require('./operators/mergeMap');
|
||
observableProto.mergeMap = mergeMap_1.mergeMap;
|
||
observableProto.flatMap = mergeMap_1.mergeMap;
|
||
var mergeMapTo_1 = require('./operators/mergeMapTo');
|
||
observableProto.mergeMapTo = mergeMapTo_1.mergeMapTo;
|
||
observableProto.flatMapTo = mergeMapTo_1.mergeMapTo;
|
||
var multicast_1 = require('./operators/multicast');
|
||
observableProto.multicast = multicast_1.multicast;
|
||
var observeOn_1 = require('./operators/observeOn');
|
||
observableProto.observeOn = observeOn_1.observeOn;
|
||
var partition_1 = require('./operators/partition');
|
||
observableProto.partition = partition_1.partition;
|
||
var publish_1 = require('./operators/publish');
|
||
observableProto.publish = publish_1.publish;
|
||
var publishBehavior_1 = require('./operators/publishBehavior');
|
||
observableProto.publishBehavior = publishBehavior_1.publishBehavior;
|
||
var publishReplay_1 = require('./operators/publishReplay');
|
||
observableProto.publishReplay = publishReplay_1.publishReplay;
|
||
var reduce_1 = require('./operators/reduce');
|
||
observableProto.reduce = reduce_1.reduce;
|
||
var repeat_1 = require('./operators/repeat');
|
||
observableProto.repeat = repeat_1.repeat;
|
||
var retry_1 = require('./operators/retry');
|
||
observableProto.retry = retry_1.retry;
|
||
var retryWhen_1 = require('./operators/retryWhen');
|
||
observableProto.retryWhen = retryWhen_1.retryWhen;
|
||
var sample_1 = require('./operators/sample');
|
||
observableProto.sample = sample_1.sample;
|
||
var sampleTime_1 = require('./operators/sampleTime');
|
||
observableProto.sampleTime = sampleTime_1.sampleTime;
|
||
var scan_1 = require('./operators/scan');
|
||
observableProto.scan = scan_1.scan;
|
||
var share_1 = require('./operators/share');
|
||
observableProto.share = share_1.share;
|
||
var single_1 = require('./operators/single');
|
||
observableProto.single = single_1.single;
|
||
var skip_1 = require('./operators/skip');
|
||
observableProto.skip = skip_1.skip;
|
||
var skipUntil_1 = require('./operators/skipUntil');
|
||
observableProto.skipUntil = skipUntil_1.skipUntil;
|
||
var startWith_1 = require('./operators/startWith');
|
||
observableProto.startWith = startWith_1.startWith;
|
||
var subscribeOn_1 = require('./operators/subscribeOn');
|
||
observableProto.subscribeOn = subscribeOn_1.subscribeOn;
|
||
var switch_1 = require('./operators/switch');
|
||
observableProto.switch = switch_1._switch;
|
||
var switchMap_1 = require('./operators/switchMap');
|
||
observableProto.switchMap = switchMap_1.switchMap;
|
||
var switchMapTo_1 = require('./operators/switchMapTo');
|
||
observableProto.switchMapTo = switchMapTo_1.switchMapTo;
|
||
var take_1 = require('./operators/take');
|
||
observableProto.take = take_1.take;
|
||
var takeUntil_1 = require('./operators/takeUntil');
|
||
observableProto.takeUntil = takeUntil_1.takeUntil;
|
||
var throttle_1 = require('./operators/throttle');
|
||
observableProto.throttle = throttle_1.throttle;
|
||
var timeout_1 = require('./operators/timeout');
|
||
observableProto.timeout = timeout_1.timeout;
|
||
var timeoutWith_1 = require('./operators/timeoutWith');
|
||
observableProto.timeoutWith = timeoutWith_1.timeoutWith;
|
||
var toArray_1 = require('./operators/toArray');
|
||
observableProto.toArray = toArray_1.toArray;
|
||
var toPromise_1 = require('./operators/toPromise');
|
||
observableProto.toPromise = toPromise_1.toPromise;
|
||
var window_1 = require('./operators/window');
|
||
observableProto.window = window_1.window;
|
||
var windowCount_1 = require('./operators/windowCount');
|
||
observableProto.windowCount = windowCount_1.windowCount;
|
||
var windowTime_1 = require('./operators/windowTime');
|
||
observableProto.windowTime = windowTime_1.windowTime;
|
||
var windowToggle_1 = require('./operators/windowToggle');
|
||
observableProto.windowToggle = windowToggle_1.windowToggle;
|
||
var windowWhen_1 = require('./operators/windowWhen');
|
||
observableProto.windowWhen = windowWhen_1.windowWhen;
|
||
var withLatestFrom_1 = require('./operators/withLatestFrom');
|
||
observableProto.withLatestFrom = withLatestFrom_1.withLatestFrom;
|
||
var zip_1 = require('./operators/zip');
|
||
observableProto.zip = zip_1.zipProto;
|
||
var zipAll_1 = require('./operators/zipAll');
|
||
observableProto.zipAll = zipAll_1.zipAll;
|
||
/* tslint:disable:no-unused-variable */
|
||
var Subject_1 = require('./Subject');
|
||
exports.Subject = Subject_1.Subject;
|
||
var Subscription_1 = require('./Subscription');
|
||
exports.Subscription = Subscription_1.Subscription;
|
||
var Subscriber_1 = require('./Subscriber');
|
||
exports.Subscriber = Subscriber_1.Subscriber;
|
||
var ReplaySubject_1 = require('./subjects/ReplaySubject');
|
||
exports.ReplaySubject = ReplaySubject_1.ReplaySubject;
|
||
var BehaviorSubject_1 = require('./subjects/BehaviorSubject');
|
||
exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject;
|
||
var ConnectableObservable_1 = require('./observables/ConnectableObservable');
|
||
exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable;
|
||
var Notification_1 = require('./Notification');
|
||
exports.Notification = Notification_1.Notification;
|
||
var EmptyError_1 = require('./util/EmptyError');
|
||
exports.EmptyError = EmptyError_1.EmptyError;
|
||
var ArgumentOutOfRangeError_1 = require('./util/ArgumentOutOfRangeError');
|
||
exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;
|
||
var nextTick_1 = require('./schedulers/nextTick');
|
||
var immediate_1 = require('./schedulers/immediate');
|
||
/* tslint:enable:no-unused-variable */
|
||
/* tslint:disable:no-var-keyword */
|
||
var Scheduler = {
|
||
nextTick: nextTick_1.nextTick,
|
||
immediate: immediate_1.immediate
|
||
};
|
||
exports.Scheduler = Scheduler;
|
||
/* tslint:enable:no-var-keyword */
|
||
//# sourceMappingURL=Rx.js.map
|
||
},{"./Notification":15,"./Observable":16,"./Subject":19,"./Subscriber":20,"./Subscription":21,"./observables/ArrayObservable":22,"./observables/ConnectableObservable":23,"./observables/DeferObservable":24,"./observables/EmptyObservable":25,"./observables/ErrorObservable":26,"./observables/ForkJoinObservable":27,"./observables/FromEventObservable":28,"./observables/FromEventPatternObservable":29,"./observables/FromObservable":30,"./observables/InfiniteObservable":31,"./observables/IntervalObservable":32,"./observables/PromiseObservable":34,"./observables/RangeObservable":35,"./observables/TimerObservable":38,"./operators/buffer":39,"./operators/bufferCount":40,"./operators/bufferTime":41,"./operators/bufferToggle":42,"./operators/bufferWhen":43,"./operators/catch":44,"./operators/combineAll":45,"./operators/combineLatest":48,"./operators/combineLatest-static":46,"./operators/concat":50,"./operators/concat-static":49,"./operators/concatAll":51,"./operators/concatMap":52,"./operators/concatMapTo":53,"./operators/count":54,"./operators/debounce":55,"./operators/debounceTime":56,"./operators/defaultIfEmpty":57,"./operators/delay":58,"./operators/dematerialize":59,"./operators/distinctUntilChanged":60,"./operators/do":61,"./operators/every":62,"./operators/expand":64,"./operators/filter":65,"./operators/finally":66,"./operators/first":67,"./operators/groupBy":69,"./operators/ignoreElements":70,"./operators/last":71,"./operators/map":72,"./operators/mapTo":73,"./operators/materialize":74,"./operators/merge":76,"./operators/merge-static":75,"./operators/mergeAll":78,"./operators/mergeMap":80,"./operators/mergeMapTo":82,"./operators/multicast":83,"./operators/observeOn":85,"./operators/partition":86,"./operators/publish":87,"./operators/publishBehavior":88,"./operators/publishReplay":89,"./operators/reduce":91,"./operators/repeat":92,"./operators/retry":93,"./operators/retryWhen":94,"./operators/sample":95,"./operators/sampleTime":96,"./operators/scan":97,"./operators/share":98,"./operators/single":99,"./operators/skip":100,"./operators/skipUntil":101,"./operators/startWith":102,"./operators/subscribeOn":103,"./operators/switch":104,"./operators/switchMap":105,"./operators/switchMapTo":106,"./operators/take":107,"./operators/takeUntil":108,"./operators/throttle":109,"./operators/timeout":110,"./operators/timeoutWith":111,"./operators/toArray":112,"./operators/toPromise":113,"./operators/window":114,"./operators/windowCount":115,"./operators/windowTime":116,"./operators/windowToggle":117,"./operators/windowWhen":118,"./operators/withLatestFrom":119,"./operators/zip":122,"./operators/zip-static":120,"./operators/zipAll":123,"./schedulers/immediate":129,"./schedulers/nextTick":130,"./subjects/BehaviorSubject":131,"./subjects/ReplaySubject":132,"./util/ArgumentOutOfRangeError":134,"./util/EmptyError":135}],19:[function(require,module,exports){
|
||
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 Observable_1 = require('./Observable');
|
||
var Subscriber_1 = require('./Subscriber');
|
||
var Subscription_1 = require('./Subscription');
|
||
var SubjectSubscription_1 = require('./subjects/SubjectSubscription');
|
||
var subscriptionAdd = Subscription_1.Subscription.prototype.add;
|
||
var subscriptionRemove = Subscription_1.Subscription.prototype.remove;
|
||
var subscriptionUnsubscribe = Subscription_1.Subscription.prototype.unsubscribe;
|
||
var subscriberNext = Subscriber_1.Subscriber.prototype.next;
|
||
var subscriberError = Subscriber_1.Subscriber.prototype.error;
|
||
var subscriberComplete = Subscriber_1.Subscriber.prototype.complete;
|
||
var _subscriberNext = Subscriber_1.Subscriber.prototype._next;
|
||
var _subscriberError = Subscriber_1.Subscriber.prototype._error;
|
||
var _subscriberComplete = Subscriber_1.Subscriber.prototype._complete;
|
||
var Subject = (function (_super) {
|
||
__extends(Subject, _super);
|
||
function Subject() {
|
||
_super.apply(this, arguments);
|
||
this.observers = [];
|
||
this.isUnsubscribed = false;
|
||
this.dispatching = false;
|
||
this.errorSignal = false;
|
||
this.completeSignal = false;
|
||
}
|
||
Subject.create = function (source, destination) {
|
||
return new BidirectionalSubject(source, destination);
|
||
};
|
||
Subject.prototype.lift = function (operator) {
|
||
var subject = new BidirectionalSubject(this, this.destination || this);
|
||
subject.operator = operator;
|
||
return subject;
|
||
};
|
||
Subject.prototype._subscribe = function (subscriber) {
|
||
if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
else if (this.errorSignal) {
|
||
subscriber.error(this.errorInstance);
|
||
return;
|
||
}
|
||
else if (this.completeSignal) {
|
||
subscriber.complete();
|
||
return;
|
||
}
|
||
else if (this.isUnsubscribed) {
|
||
throw new Error('Cannot subscribe to a disposed Subject.');
|
||
}
|
||
this.observers.push(subscriber);
|
||
return new SubjectSubscription_1.SubjectSubscription(this, subscriber);
|
||
};
|
||
Subject.prototype.add = function (subscription) {
|
||
subscriptionAdd.call(this, subscription);
|
||
};
|
||
Subject.prototype.remove = function (subscription) {
|
||
subscriptionRemove.call(this, subscription);
|
||
};
|
||
Subject.prototype.unsubscribe = function () {
|
||
this.observers = void 0;
|
||
subscriptionUnsubscribe.call(this);
|
||
};
|
||
Subject.prototype.next = function (value) {
|
||
if (this.isUnsubscribed) {
|
||
return;
|
||
}
|
||
this.dispatching = true;
|
||
this._next(value);
|
||
this.dispatching = false;
|
||
if (this.errorSignal) {
|
||
this.error(this.errorInstance);
|
||
}
|
||
else if (this.completeSignal) {
|
||
this.complete();
|
||
}
|
||
};
|
||
Subject.prototype.error = function (err) {
|
||
if (this.isUnsubscribed || this.completeSignal) {
|
||
return;
|
||
}
|
||
this.errorSignal = true;
|
||
this.errorInstance = err;
|
||
if (this.dispatching) {
|
||
return;
|
||
}
|
||
this._error(err);
|
||
this.unsubscribe();
|
||
};
|
||
Subject.prototype.complete = function () {
|
||
if (this.isUnsubscribed || this.errorSignal) {
|
||
return;
|
||
}
|
||
this.completeSignal = true;
|
||
if (this.dispatching) {
|
||
return;
|
||
}
|
||
this._complete();
|
||
this.unsubscribe();
|
||
};
|
||
Subject.prototype._next = function (value) {
|
||
var index = -1;
|
||
var observers = this.observers.slice(0);
|
||
var len = observers.length;
|
||
while (++index < len) {
|
||
observers[index].next(value);
|
||
}
|
||
};
|
||
Subject.prototype._error = function (err) {
|
||
var index = -1;
|
||
var observers = this.observers;
|
||
var len = observers.length;
|
||
// optimization -- block next, complete, and unsubscribe while dispatching
|
||
this.observers = void 0;
|
||
this.isUnsubscribed = true;
|
||
while (++index < len) {
|
||
observers[index].error(err);
|
||
}
|
||
this.isUnsubscribed = false;
|
||
};
|
||
Subject.prototype._complete = function () {
|
||
var index = -1;
|
||
var observers = this.observers;
|
||
var len = observers.length;
|
||
// optimization -- block next, complete, and unsubscribe while dispatching
|
||
this.observers = void 0; // optimization
|
||
this.isUnsubscribed = true;
|
||
while (++index < len) {
|
||
observers[index].complete();
|
||
}
|
||
this.isUnsubscribed = false;
|
||
};
|
||
return Subject;
|
||
})(Observable_1.Observable);
|
||
exports.Subject = Subject;
|
||
var BidirectionalSubject = (function (_super) {
|
||
__extends(BidirectionalSubject, _super);
|
||
function BidirectionalSubject(source, destination) {
|
||
_super.call(this);
|
||
this.source = source;
|
||
this.destination = destination;
|
||
}
|
||
BidirectionalSubject.prototype._subscribe = function (subscriber) {
|
||
var operator = this.operator;
|
||
return this.source._subscribe.call(this.source, operator ? operator.call(subscriber) : subscriber);
|
||
};
|
||
BidirectionalSubject.prototype.next = function (value) {
|
||
subscriberNext.call(this, value);
|
||
};
|
||
BidirectionalSubject.prototype.error = function (err) {
|
||
subscriberError.call(this, err);
|
||
};
|
||
BidirectionalSubject.prototype.complete = function () {
|
||
subscriberComplete.call(this);
|
||
};
|
||
BidirectionalSubject.prototype._next = function (value) {
|
||
_subscriberNext.call(this, value);
|
||
};
|
||
BidirectionalSubject.prototype._error = function (err) {
|
||
_subscriberError.call(this, err);
|
||
};
|
||
BidirectionalSubject.prototype._complete = function () {
|
||
_subscriberComplete.call(this);
|
||
};
|
||
return BidirectionalSubject;
|
||
})(Subject);
|
||
//# sourceMappingURL=Subject.js.map
|
||
},{"./Observable":16,"./Subscriber":20,"./Subscription":21,"./subjects/SubjectSubscription":133}],20:[function(require,module,exports){
|
||
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 noop_1 = require('./util/noop');
|
||
var throwError_1 = require('./util/throwError');
|
||
var tryOrOnError_1 = require('./util/tryOrOnError');
|
||
var Subscription_1 = require('./Subscription');
|
||
var Subscriber = (function (_super) {
|
||
__extends(Subscriber, _super);
|
||
function Subscriber(destination) {
|
||
_super.call(this);
|
||
this.destination = destination;
|
||
this._isUnsubscribed = false;
|
||
if (!this.destination) {
|
||
return;
|
||
}
|
||
var subscription = destination._subscription;
|
||
if (subscription) {
|
||
this._subscription = subscription;
|
||
}
|
||
else if (destination instanceof Subscriber) {
|
||
this._subscription = destination;
|
||
}
|
||
}
|
||
Object.defineProperty(Subscriber.prototype, "isUnsubscribed", {
|
||
get: function () {
|
||
var subscription = this._subscription;
|
||
if (subscription) {
|
||
// route to the shared Subscription if it exists
|
||
return this._isUnsubscribed || subscription.isUnsubscribed;
|
||
}
|
||
else {
|
||
return this._isUnsubscribed;
|
||
}
|
||
},
|
||
set: function (value) {
|
||
var subscription = this._subscription;
|
||
if (subscription) {
|
||
// route to the shared Subscription if it exists
|
||
subscription.isUnsubscribed = Boolean(value);
|
||
}
|
||
else {
|
||
this._isUnsubscribed = Boolean(value);
|
||
}
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
Subscriber.create = function (next, error, complete) {
|
||
var subscriber = new Subscriber();
|
||
subscriber._next = (typeof next === 'function') && tryOrOnError_1.tryOrOnError(next) || noop_1.noop;
|
||
subscriber._error = (typeof error === 'function') && error || throwError_1.throwError;
|
||
subscriber._complete = (typeof complete === 'function') && complete || noop_1.noop;
|
||
return subscriber;
|
||
};
|
||
Subscriber.prototype.add = function (sub) {
|
||
// route add to the shared Subscription if it exists
|
||
var _subscription = this._subscription;
|
||
if (_subscription) {
|
||
_subscription.add(sub);
|
||
}
|
||
else {
|
||
_super.prototype.add.call(this, sub);
|
||
}
|
||
};
|
||
Subscriber.prototype.remove = function (sub) {
|
||
// route remove to the shared Subscription if it exists
|
||
if (this._subscription) {
|
||
this._subscription.remove(sub);
|
||
}
|
||
else {
|
||
_super.prototype.remove.call(this, sub);
|
||
}
|
||
};
|
||
Subscriber.prototype.unsubscribe = function () {
|
||
if (this._isUnsubscribed) {
|
||
return;
|
||
}
|
||
else if (this._subscription) {
|
||
this._isUnsubscribed = true;
|
||
}
|
||
else {
|
||
_super.prototype.unsubscribe.call(this);
|
||
}
|
||
};
|
||
Subscriber.prototype._next = function (value) {
|
||
this.destination.next(value);
|
||
};
|
||
Subscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
Subscriber.prototype._complete = function () {
|
||
this.destination.complete();
|
||
};
|
||
Subscriber.prototype.next = function (value) {
|
||
if (!this.isUnsubscribed) {
|
||
this._next(value);
|
||
}
|
||
};
|
||
Subscriber.prototype.error = function (err) {
|
||
if (!this.isUnsubscribed) {
|
||
this._error(err);
|
||
this.unsubscribe();
|
||
}
|
||
};
|
||
Subscriber.prototype.complete = function () {
|
||
if (!this.isUnsubscribed) {
|
||
this._complete();
|
||
this.unsubscribe();
|
||
}
|
||
};
|
||
return Subscriber;
|
||
})(Subscription_1.Subscription);
|
||
exports.Subscriber = Subscriber;
|
||
//# sourceMappingURL=Subscriber.js.map
|
||
},{"./Subscription":21,"./util/noop":147,"./util/throwError":151,"./util/tryOrOnError":153}],21:[function(require,module,exports){
|
||
var noop_1 = require('./util/noop');
|
||
var Subscription = (function () {
|
||
function Subscription(_unsubscribe) {
|
||
this.isUnsubscribed = false;
|
||
if (_unsubscribe) {
|
||
this._unsubscribe = _unsubscribe;
|
||
}
|
||
}
|
||
Subscription.prototype._unsubscribe = function () {
|
||
noop_1.noop();
|
||
};
|
||
Subscription.prototype.unsubscribe = function () {
|
||
if (this.isUnsubscribed) {
|
||
return;
|
||
}
|
||
this.isUnsubscribed = true;
|
||
var unsubscribe = this._unsubscribe;
|
||
var subscriptions = this._subscriptions;
|
||
this._subscriptions = void 0;
|
||
if (unsubscribe) {
|
||
unsubscribe.call(this);
|
||
}
|
||
if (subscriptions != null) {
|
||
var index = -1;
|
||
var len = subscriptions.length;
|
||
while (++index < len) {
|
||
subscriptions[index].unsubscribe();
|
||
}
|
||
}
|
||
};
|
||
Subscription.prototype.add = function (subscription) {
|
||
// return early if:
|
||
// 1. the subscription is null
|
||
// 2. we're attempting to add our this
|
||
// 3. we're attempting to add the static `empty` Subscription
|
||
if (!subscription || (subscription === this) || (subscription === Subscription.EMPTY)) {
|
||
return;
|
||
}
|
||
var sub = subscription;
|
||
switch (typeof subscription) {
|
||
case 'function':
|
||
sub = new Subscription(subscription);
|
||
case 'object':
|
||
if (sub.isUnsubscribed || typeof sub.unsubscribe !== 'function') {
|
||
break;
|
||
}
|
||
else if (this.isUnsubscribed) {
|
||
sub.unsubscribe();
|
||
}
|
||
else {
|
||
var subscriptions = this._subscriptions || (this._subscriptions = []);
|
||
subscriptions.push(sub);
|
||
}
|
||
break;
|
||
default:
|
||
throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.');
|
||
}
|
||
};
|
||
Subscription.prototype.remove = function (subscription) {
|
||
// return early if:
|
||
// 1. the subscription is null
|
||
// 2. we're attempting to remove ourthis
|
||
// 3. we're attempting to remove the static `empty` Subscription
|
||
if (subscription == null || (subscription === this) || (subscription === Subscription.EMPTY)) {
|
||
return;
|
||
}
|
||
var subscriptions = this._subscriptions;
|
||
if (subscriptions) {
|
||
var subscriptionIndex = subscriptions.indexOf(subscription);
|
||
if (subscriptionIndex !== -1) {
|
||
subscriptions.splice(subscriptionIndex, 1);
|
||
}
|
||
}
|
||
};
|
||
Subscription.EMPTY = (function (empty) {
|
||
empty.isUnsubscribed = true;
|
||
return empty;
|
||
}(new Subscription()));
|
||
return Subscription;
|
||
})();
|
||
exports.Subscription = Subscription;
|
||
//# sourceMappingURL=Subscription.js.map
|
||
},{"./util/noop":147}],22:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var ScalarObservable_1 = require('./ScalarObservable');
|
||
var EmptyObservable_1 = require('./EmptyObservable');
|
||
var ArrayObservable = (function (_super) {
|
||
__extends(ArrayObservable, _super);
|
||
function ArrayObservable(array, scheduler) {
|
||
_super.call(this);
|
||
this.array = array;
|
||
this.scheduler = scheduler;
|
||
if (!scheduler && array.length === 1) {
|
||
this._isScalar = true;
|
||
this.value = array[0];
|
||
}
|
||
}
|
||
ArrayObservable.create = function (array, scheduler) {
|
||
return new ArrayObservable(array, scheduler);
|
||
};
|
||
ArrayObservable.of = function () {
|
||
var array = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
array[_i - 0] = arguments[_i];
|
||
}
|
||
var scheduler = array[array.length - 1];
|
||
if (scheduler && typeof scheduler.schedule === 'function') {
|
||
array.pop();
|
||
}
|
||
else {
|
||
scheduler = void 0;
|
||
}
|
||
var len = array.length;
|
||
if (len > 1) {
|
||
return new ArrayObservable(array, scheduler);
|
||
}
|
||
else if (len === 1) {
|
||
return new ScalarObservable_1.ScalarObservable(array[0], scheduler);
|
||
}
|
||
else {
|
||
return new EmptyObservable_1.EmptyObservable(scheduler);
|
||
}
|
||
};
|
||
ArrayObservable.dispatch = function (state) {
|
||
var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;
|
||
if (index >= count) {
|
||
subscriber.complete();
|
||
return;
|
||
}
|
||
subscriber.next(array[index]);
|
||
if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
state.index = index + 1;
|
||
this.schedule(state);
|
||
};
|
||
ArrayObservable.prototype._subscribe = function (subscriber) {
|
||
var index = 0;
|
||
var array = this.array;
|
||
var count = array.length;
|
||
var scheduler = this.scheduler;
|
||
if (scheduler) {
|
||
subscriber.add(scheduler.schedule(ArrayObservable.dispatch, 0, {
|
||
array: array, index: index, count: count, subscriber: subscriber
|
||
}));
|
||
}
|
||
else {
|
||
for (var i = 0; i < count && !subscriber.isUnsubscribed; i++) {
|
||
subscriber.next(array[i]);
|
||
}
|
||
subscriber.complete();
|
||
}
|
||
};
|
||
return ArrayObservable;
|
||
})(Observable_1.Observable);
|
||
exports.ArrayObservable = ArrayObservable;
|
||
//# sourceMappingURL=ArrayObservable.js.map
|
||
},{"../Observable":16,"./EmptyObservable":25,"./ScalarObservable":36}],23:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var Subscription_1 = require('../Subscription');
|
||
var ConnectableObservable = (function (_super) {
|
||
__extends(ConnectableObservable, _super);
|
||
function ConnectableObservable(source, subjectFactory) {
|
||
_super.call(this);
|
||
this.source = source;
|
||
this.subjectFactory = subjectFactory;
|
||
}
|
||
ConnectableObservable.prototype._subscribe = function (subscriber) {
|
||
return this._getSubject().subscribe(subscriber);
|
||
};
|
||
ConnectableObservable.prototype._getSubject = function () {
|
||
var subject = this.subject;
|
||
if (subject && !subject.isUnsubscribed) {
|
||
return subject;
|
||
}
|
||
return (this.subject = this.subjectFactory());
|
||
};
|
||
ConnectableObservable.prototype.connect = function () {
|
||
var source = this.source;
|
||
var subscription = this.subscription;
|
||
if (subscription && !subscription.isUnsubscribed) {
|
||
return subscription;
|
||
}
|
||
subscription = source.subscribe(this._getSubject());
|
||
subscription.add(new ConnectableSubscription(this));
|
||
return (this.subscription = subscription);
|
||
};
|
||
ConnectableObservable.prototype.refCount = function () {
|
||
return new RefCountObservable(this);
|
||
};
|
||
return ConnectableObservable;
|
||
})(Observable_1.Observable);
|
||
exports.ConnectableObservable = ConnectableObservable;
|
||
var ConnectableSubscription = (function (_super) {
|
||
__extends(ConnectableSubscription, _super);
|
||
function ConnectableSubscription(connectable) {
|
||
_super.call(this);
|
||
this.connectable = connectable;
|
||
}
|
||
ConnectableSubscription.prototype._unsubscribe = function () {
|
||
var connectable = this.connectable;
|
||
connectable.subject = void 0;
|
||
connectable.subscription = void 0;
|
||
this.connectable = void 0;
|
||
};
|
||
return ConnectableSubscription;
|
||
})(Subscription_1.Subscription);
|
||
var RefCountObservable = (function (_super) {
|
||
__extends(RefCountObservable, _super);
|
||
function RefCountObservable(connectable, refCount) {
|
||
if (refCount === void 0) { refCount = 0; }
|
||
_super.call(this);
|
||
this.connectable = connectable;
|
||
this.refCount = refCount;
|
||
}
|
||
RefCountObservable.prototype._subscribe = function (subscriber) {
|
||
var connectable = this.connectable;
|
||
var subscription = connectable.subscribe(subscriber);
|
||
if (++this.refCount === 1) {
|
||
this.connection = connectable.connect();
|
||
}
|
||
subscription.add(new RefCountSubscription(this));
|
||
return subscription;
|
||
};
|
||
return RefCountObservable;
|
||
})(Observable_1.Observable);
|
||
var RefCountSubscription = (function (_super) {
|
||
__extends(RefCountSubscription, _super);
|
||
function RefCountSubscription(refCountObservable) {
|
||
_super.call(this);
|
||
this.refCountObservable = refCountObservable;
|
||
}
|
||
RefCountSubscription.prototype._unsubscribe = function () {
|
||
var observable = this.refCountObservable;
|
||
if (--observable.refCount === 0) {
|
||
observable.connection.unsubscribe();
|
||
observable.connection = void 0;
|
||
}
|
||
};
|
||
return RefCountSubscription;
|
||
})(Subscription_1.Subscription);
|
||
//# sourceMappingURL=ConnectableObservable.js.map
|
||
},{"../Observable":16,"../Subscription":21}],24:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var DeferObservable = (function (_super) {
|
||
__extends(DeferObservable, _super);
|
||
function DeferObservable(observableFactory) {
|
||
_super.call(this);
|
||
this.observableFactory = observableFactory;
|
||
}
|
||
DeferObservable.create = function (observableFactory) {
|
||
return new DeferObservable(observableFactory);
|
||
};
|
||
DeferObservable.prototype._subscribe = function (subscriber) {
|
||
var result = tryCatch_1.tryCatch(this.observableFactory)();
|
||
if (result === errorObject_1.errorObject) {
|
||
subscriber.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
result.subscribe(subscriber);
|
||
}
|
||
};
|
||
return DeferObservable;
|
||
})(Observable_1.Observable);
|
||
exports.DeferObservable = DeferObservable;
|
||
//# sourceMappingURL=DeferObservable.js.map
|
||
},{"../Observable":16,"../util/errorObject":143,"../util/tryCatch":152}],25:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var EmptyObservable = (function (_super) {
|
||
__extends(EmptyObservable, _super);
|
||
function EmptyObservable(scheduler) {
|
||
_super.call(this);
|
||
this.scheduler = scheduler;
|
||
}
|
||
EmptyObservable.create = function (scheduler) {
|
||
return new EmptyObservable(scheduler);
|
||
};
|
||
EmptyObservable.dispatch = function (_a) {
|
||
var subscriber = _a.subscriber;
|
||
subscriber.complete();
|
||
};
|
||
EmptyObservable.prototype._subscribe = function (subscriber) {
|
||
var scheduler = this.scheduler;
|
||
if (scheduler) {
|
||
subscriber.add(scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber }));
|
||
}
|
||
else {
|
||
subscriber.complete();
|
||
}
|
||
};
|
||
return EmptyObservable;
|
||
})(Observable_1.Observable);
|
||
exports.EmptyObservable = EmptyObservable;
|
||
//# sourceMappingURL=EmptyObservable.js.map
|
||
},{"../Observable":16}],26:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var ErrorObservable = (function (_super) {
|
||
__extends(ErrorObservable, _super);
|
||
function ErrorObservable(error, scheduler) {
|
||
_super.call(this);
|
||
this.error = error;
|
||
this.scheduler = scheduler;
|
||
}
|
||
ErrorObservable.create = function (error, scheduler) {
|
||
return new ErrorObservable(error, scheduler);
|
||
};
|
||
ErrorObservable.dispatch = function (_a) {
|
||
var error = _a.error, subscriber = _a.subscriber;
|
||
subscriber.error(error);
|
||
};
|
||
ErrorObservable.prototype._subscribe = function (subscriber) {
|
||
var error = this.error;
|
||
var scheduler = this.scheduler;
|
||
if (scheduler) {
|
||
subscriber.add(scheduler.schedule(ErrorObservable.dispatch, 0, {
|
||
error: error, subscriber: subscriber
|
||
}));
|
||
}
|
||
else {
|
||
subscriber.error(error);
|
||
}
|
||
};
|
||
return ErrorObservable;
|
||
})(Observable_1.Observable);
|
||
exports.ErrorObservable = ErrorObservable;
|
||
//# sourceMappingURL=ErrorObservable.js.map
|
||
},{"../Observable":16}],27:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var Subscriber_1 = require('../Subscriber');
|
||
var PromiseObservable_1 = require('./PromiseObservable');
|
||
var EmptyObservable_1 = require('./EmptyObservable');
|
||
var isPromise_1 = require('../util/isPromise');
|
||
var ForkJoinObservable = (function (_super) {
|
||
__extends(ForkJoinObservable, _super);
|
||
function ForkJoinObservable(sources) {
|
||
_super.call(this);
|
||
this.sources = sources;
|
||
}
|
||
ForkJoinObservable.create = function () {
|
||
var sources = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
sources[_i - 0] = arguments[_i];
|
||
}
|
||
if (sources === null || sources.length === 0) {
|
||
return new EmptyObservable_1.EmptyObservable();
|
||
}
|
||
return new ForkJoinObservable(sources);
|
||
};
|
||
ForkJoinObservable.prototype.getResultSelector = function () {
|
||
var sources = this.sources;
|
||
var resultSelector = sources[sources.length - 1];
|
||
if (typeof resultSelector !== 'function') {
|
||
return null;
|
||
}
|
||
this.sources.pop();
|
||
return resultSelector;
|
||
};
|
||
ForkJoinObservable.prototype._subscribe = function (subscriber) {
|
||
var resultSelector = this.getResultSelector();
|
||
var sources = this.sources;
|
||
var len = sources.length;
|
||
var context = { completed: 0, total: len, values: emptyArray(len), selector: resultSelector };
|
||
for (var i = 0; i < len; i++) {
|
||
var source = sources[i];
|
||
if (isPromise_1.isPromise(source)) {
|
||
source = new PromiseObservable_1.PromiseObservable(source);
|
||
}
|
||
source.subscribe(new AllSubscriber(subscriber, i, context));
|
||
}
|
||
};
|
||
return ForkJoinObservable;
|
||
})(Observable_1.Observable);
|
||
exports.ForkJoinObservable = ForkJoinObservable;
|
||
var AllSubscriber = (function (_super) {
|
||
__extends(AllSubscriber, _super);
|
||
function AllSubscriber(destination, index, context) {
|
||
_super.call(this, destination);
|
||
this.index = index;
|
||
this.context = context;
|
||
this._value = null;
|
||
}
|
||
AllSubscriber.prototype._next = function (value) {
|
||
this._value = value;
|
||
};
|
||
AllSubscriber.prototype._complete = function () {
|
||
var destination = this.destination;
|
||
if (this._value == null) {
|
||
destination.complete();
|
||
}
|
||
var context = this.context;
|
||
context.completed++;
|
||
context.values[this.index] = this._value;
|
||
var values = context.values;
|
||
if (context.completed !== values.length) {
|
||
return;
|
||
}
|
||
if (values.every(hasValue)) {
|
||
var value = context.selector ? context.selector.apply(this, values) :
|
||
values;
|
||
destination.next(value);
|
||
}
|
||
destination.complete();
|
||
};
|
||
return AllSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
function hasValue(x) {
|
||
return x !== null;
|
||
}
|
||
function emptyArray(len) {
|
||
var arr = [];
|
||
for (var i = 0; i < len; i++) {
|
||
arr.push(null);
|
||
}
|
||
return arr;
|
||
}
|
||
//# sourceMappingURL=ForkJoinObservable.js.map
|
||
},{"../Observable":16,"../Subscriber":20,"../util/isPromise":146,"./EmptyObservable":25,"./PromiseObservable":34}],28:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var Subscription_1 = require('../Subscription');
|
||
var FromEventObservable = (function (_super) {
|
||
__extends(FromEventObservable, _super);
|
||
function FromEventObservable(sourceObj, eventName, selector) {
|
||
_super.call(this);
|
||
this.sourceObj = sourceObj;
|
||
this.eventName = eventName;
|
||
this.selector = selector;
|
||
}
|
||
FromEventObservable.create = function (sourceObj, eventName, selector) {
|
||
return new FromEventObservable(sourceObj, eventName, selector);
|
||
};
|
||
FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber) {
|
||
var unsubscribe;
|
||
var tag = sourceObj.toString();
|
||
if (tag === '[object NodeList]' || tag === '[object HTMLCollection]') {
|
||
for (var i = 0, len = sourceObj.length; i < len; i++) {
|
||
FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber);
|
||
}
|
||
}
|
||
else if (typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function') {
|
||
sourceObj.addEventListener(eventName, handler);
|
||
unsubscribe = function () { return sourceObj.removeEventListener(eventName, handler); };
|
||
}
|
||
else if (typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function') {
|
||
sourceObj.on(eventName, handler);
|
||
unsubscribe = function () { return sourceObj.off(eventName, handler); };
|
||
}
|
||
else if (typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function') {
|
||
sourceObj.addListener(eventName, handler);
|
||
unsubscribe = function () { return sourceObj.removeListener(eventName, handler); };
|
||
}
|
||
subscriber.add(new Subscription_1.Subscription(unsubscribe));
|
||
};
|
||
FromEventObservable.prototype._subscribe = function (subscriber) {
|
||
var sourceObj = this.sourceObj;
|
||
var eventName = this.eventName;
|
||
var selector = this.selector;
|
||
var handler = selector ? function (e) {
|
||
var result = tryCatch_1.tryCatch(selector)(e);
|
||
if (result === errorObject_1.errorObject) {
|
||
subscriber.error(result.e);
|
||
}
|
||
else {
|
||
subscriber.next(result);
|
||
}
|
||
} : function (e) { return subscriber.next(e); };
|
||
FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber);
|
||
};
|
||
return FromEventObservable;
|
||
})(Observable_1.Observable);
|
||
exports.FromEventObservable = FromEventObservable;
|
||
//# sourceMappingURL=FromEventObservable.js.map
|
||
},{"../Observable":16,"../Subscription":21,"../util/errorObject":143,"../util/tryCatch":152}],29:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var Subscription_1 = require('../Subscription');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var FromEventPatternObservable = (function (_super) {
|
||
__extends(FromEventPatternObservable, _super);
|
||
function FromEventPatternObservable(addHandler, removeHandler, selector) {
|
||
_super.call(this);
|
||
this.addHandler = addHandler;
|
||
this.removeHandler = removeHandler;
|
||
this.selector = selector;
|
||
}
|
||
FromEventPatternObservable.create = function (addHandler, removeHandler, selector) {
|
||
return new FromEventPatternObservable(addHandler, removeHandler, selector);
|
||
};
|
||
FromEventPatternObservable.prototype._subscribe = function (subscriber) {
|
||
var addHandler = this.addHandler;
|
||
var removeHandler = this.removeHandler;
|
||
var selector = this.selector;
|
||
var handler = selector ? function (e) {
|
||
var result = tryCatch_1.tryCatch(selector).apply(null, arguments);
|
||
if (result === errorObject_1.errorObject) {
|
||
subscriber.error(result.e);
|
||
}
|
||
else {
|
||
subscriber.next(result);
|
||
}
|
||
} : function (e) { subscriber.next(e); };
|
||
var result = tryCatch_1.tryCatch(addHandler)(handler);
|
||
if (result === errorObject_1.errorObject) {
|
||
subscriber.error(result.e);
|
||
}
|
||
subscriber.add(new Subscription_1.Subscription(function () {
|
||
//TODO: determine whether or not to forward to error handler
|
||
removeHandler(handler);
|
||
}));
|
||
};
|
||
return FromEventPatternObservable;
|
||
})(Observable_1.Observable);
|
||
exports.FromEventPatternObservable = FromEventPatternObservable;
|
||
//# sourceMappingURL=FromEventPatternObservable.js.map
|
||
},{"../Observable":16,"../Subscription":21,"../util/errorObject":143,"../util/tryCatch":152}],30:[function(require,module,exports){
|
||
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 PromiseObservable_1 = require('./PromiseObservable');
|
||
var IteratorObservable_1 = require('./IteratorObservable');
|
||
var ArrayObservable_1 = require('./ArrayObservable');
|
||
var Symbol_observable_1 = require('../util/Symbol_observable');
|
||
var Symbol_iterator_1 = require('../util/Symbol_iterator');
|
||
var Observable_1 = require('../Observable');
|
||
var observeOn_support_1 = require('../operators/observeOn-support');
|
||
var immediate_1 = require('../schedulers/immediate');
|
||
var isArray = Array.isArray;
|
||
var FromObservable = (function (_super) {
|
||
__extends(FromObservable, _super);
|
||
function FromObservable(ish, scheduler) {
|
||
_super.call(this, null);
|
||
this.ish = ish;
|
||
this.scheduler = scheduler;
|
||
}
|
||
FromObservable.create = function (ish, scheduler) {
|
||
if (scheduler === void 0) { scheduler = immediate_1.immediate; }
|
||
if (ish) {
|
||
if (isArray(ish)) {
|
||
return new ArrayObservable_1.ArrayObservable(ish, scheduler);
|
||
}
|
||
else if (typeof ish.then === 'function') {
|
||
return new PromiseObservable_1.PromiseObservable(ish, scheduler);
|
||
}
|
||
else if (typeof ish[Symbol_observable_1.$$observable] === 'function') {
|
||
if (ish instanceof Observable_1.Observable) {
|
||
return ish;
|
||
}
|
||
return new FromObservable(ish, scheduler);
|
||
}
|
||
else if (typeof ish[Symbol_iterator_1.$$iterator] === 'function') {
|
||
return new IteratorObservable_1.IteratorObservable(ish, null, null, scheduler);
|
||
}
|
||
}
|
||
throw new TypeError((typeof ish) + ' is not observable');
|
||
};
|
||
FromObservable.prototype._subscribe = function (subscriber) {
|
||
var ish = this.ish;
|
||
var scheduler = this.scheduler;
|
||
if (scheduler === immediate_1.immediate) {
|
||
return ish[Symbol_observable_1.$$observable]().subscribe(subscriber);
|
||
}
|
||
else {
|
||
return ish[Symbol_observable_1.$$observable]().subscribe(new observeOn_support_1.ObserveOnSubscriber(subscriber, scheduler, 0));
|
||
}
|
||
};
|
||
return FromObservable;
|
||
})(Observable_1.Observable);
|
||
exports.FromObservable = FromObservable;
|
||
//# sourceMappingURL=FromObservable.js.map
|
||
},{"../Observable":16,"../operators/observeOn-support":84,"../schedulers/immediate":129,"../util/Symbol_iterator":140,"../util/Symbol_observable":141,"./ArrayObservable":22,"./IteratorObservable":33,"./PromiseObservable":34}],31:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var noop_1 = require('../util/noop');
|
||
var InfiniteObservable = (function (_super) {
|
||
__extends(InfiniteObservable, _super);
|
||
function InfiniteObservable() {
|
||
_super.call(this);
|
||
}
|
||
InfiniteObservable.create = function () {
|
||
return new InfiniteObservable();
|
||
};
|
||
InfiniteObservable.prototype._subscribe = function (subscriber) {
|
||
noop_1.noop();
|
||
};
|
||
return InfiniteObservable;
|
||
})(Observable_1.Observable);
|
||
exports.InfiniteObservable = InfiniteObservable;
|
||
//# sourceMappingURL=InfiniteObservable.js.map
|
||
},{"../Observable":16,"../util/noop":147}],32:[function(require,module,exports){
|
||
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 isNumeric_1 = require('../util/isNumeric');
|
||
var Observable_1 = require('../Observable');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
var IntervalObservable = (function (_super) {
|
||
__extends(IntervalObservable, _super);
|
||
function IntervalObservable(period, scheduler) {
|
||
if (period === void 0) { period = 0; }
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
_super.call(this);
|
||
this.period = period;
|
||
this.scheduler = scheduler;
|
||
if (!isNumeric_1.isNumeric(period) || period < 0) {
|
||
this.period = 0;
|
||
}
|
||
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||
this.scheduler = nextTick_1.nextTick;
|
||
}
|
||
}
|
||
IntervalObservable.create = function (period, scheduler) {
|
||
if (period === void 0) { period = 0; }
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return new IntervalObservable(period, scheduler);
|
||
};
|
||
IntervalObservable.dispatch = function (state) {
|
||
var index = state.index, subscriber = state.subscriber, period = state.period;
|
||
subscriber.next(index);
|
||
if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
state.index += 1;
|
||
this.schedule(state, period);
|
||
};
|
||
IntervalObservable.prototype._subscribe = function (subscriber) {
|
||
var index = 0;
|
||
var period = this.period;
|
||
var scheduler = this.scheduler;
|
||
subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, {
|
||
index: index, subscriber: subscriber, period: period
|
||
}));
|
||
};
|
||
return IntervalObservable;
|
||
})(Observable_1.Observable);
|
||
exports.IntervalObservable = IntervalObservable;
|
||
//# sourceMappingURL=IntervalObservable.js.map
|
||
},{"../Observable":16,"../schedulers/nextTick":130,"../util/isNumeric":145}],33:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var root_1 = require('../util/root');
|
||
var Symbol_iterator_1 = require('../util/Symbol_iterator');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var IteratorObservable = (function (_super) {
|
||
__extends(IteratorObservable, _super);
|
||
function IteratorObservable(iterator, project, thisArg, scheduler) {
|
||
_super.call(this);
|
||
this.iterator = iterator;
|
||
this.project = project;
|
||
this.thisArg = thisArg;
|
||
this.scheduler = scheduler;
|
||
}
|
||
IteratorObservable.create = function (iterator, project, thisArg, scheduler) {
|
||
if (iterator == null) {
|
||
throw new Error('iterator cannot be null.');
|
||
}
|
||
if (project && typeof project !== 'function') {
|
||
throw new Error('When provided, `project` must be a function.');
|
||
}
|
||
return new IteratorObservable(iterator, project, thisArg, scheduler);
|
||
};
|
||
IteratorObservable.dispatch = function (state) {
|
||
var index = state.index, hasError = state.hasError, thisArg = state.thisArg, project = state.project, iterator = state.iterator, subscriber = state.subscriber;
|
||
if (hasError) {
|
||
subscriber.error(state.error);
|
||
return;
|
||
}
|
||
var result = iterator.next();
|
||
if (result.done) {
|
||
subscriber.complete();
|
||
return;
|
||
}
|
||
if (project) {
|
||
result = tryCatch_1.tryCatch(project).call(thisArg, result.value, index);
|
||
if (result === errorObject_1.errorObject) {
|
||
state.error = errorObject_1.errorObject.e;
|
||
state.hasError = true;
|
||
}
|
||
else {
|
||
subscriber.next(result);
|
||
state.index = index + 1;
|
||
}
|
||
}
|
||
else {
|
||
subscriber.next(result.value);
|
||
state.index = index + 1;
|
||
}
|
||
if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
this.schedule(state);
|
||
};
|
||
IteratorObservable.prototype._subscribe = function (subscriber) {
|
||
var index = 0;
|
||
var project = this.project;
|
||
var thisArg = this.thisArg;
|
||
var iterator = getIterator(Object(this.iterator));
|
||
var scheduler = this.scheduler;
|
||
if (scheduler) {
|
||
subscriber.add(scheduler.schedule(IteratorObservable.dispatch, 0, {
|
||
index: index, thisArg: thisArg, project: project, iterator: iterator, subscriber: subscriber
|
||
}));
|
||
}
|
||
else {
|
||
do {
|
||
var result = iterator.next();
|
||
if (result.done) {
|
||
subscriber.complete();
|
||
break;
|
||
}
|
||
else if (project) {
|
||
result = tryCatch_1.tryCatch(project).call(thisArg, result.value, index++);
|
||
if (result === errorObject_1.errorObject) {
|
||
subscriber.error(errorObject_1.errorObject.e);
|
||
break;
|
||
}
|
||
subscriber.next(result);
|
||
}
|
||
else {
|
||
subscriber.next(result.value);
|
||
}
|
||
if (subscriber.isUnsubscribed) {
|
||
break;
|
||
}
|
||
} while (true);
|
||
}
|
||
};
|
||
return IteratorObservable;
|
||
})(Observable_1.Observable);
|
||
exports.IteratorObservable = IteratorObservable;
|
||
var maxSafeInteger = Math.pow(2, 53) - 1;
|
||
var StringIterator = (function () {
|
||
function StringIterator(str, idx, len) {
|
||
if (idx === void 0) { idx = 0; }
|
||
if (len === void 0) { len = str.length; }
|
||
this.str = str;
|
||
this.idx = idx;
|
||
this.len = len;
|
||
}
|
||
StringIterator.prototype[Symbol_iterator_1.$$iterator] = function () { return (this); };
|
||
StringIterator.prototype.next = function () {
|
||
return this.idx < this.len ? {
|
||
done: false,
|
||
value: this.str.charAt(this.idx++)
|
||
} : {
|
||
done: true,
|
||
value: undefined
|
||
};
|
||
};
|
||
return StringIterator;
|
||
})();
|
||
var ArrayIterator = (function () {
|
||
function ArrayIterator(arr, idx, len) {
|
||
if (idx === void 0) { idx = 0; }
|
||
if (len === void 0) { len = toLength(arr); }
|
||
this.arr = arr;
|
||
this.idx = idx;
|
||
this.len = len;
|
||
}
|
||
ArrayIterator.prototype[Symbol_iterator_1.$$iterator] = function () { return this; };
|
||
ArrayIterator.prototype.next = function () {
|
||
return this.idx < this.len ? {
|
||
done: false,
|
||
value: this.arr[this.idx++]
|
||
} : {
|
||
done: true,
|
||
value: undefined
|
||
};
|
||
};
|
||
return ArrayIterator;
|
||
})();
|
||
function getIterator(o) {
|
||
var i = o[Symbol_iterator_1.$$iterator];
|
||
if (!i && typeof o === 'string') {
|
||
return new StringIterator(o);
|
||
}
|
||
if (!i && o.length !== undefined) {
|
||
return new ArrayIterator(o);
|
||
}
|
||
if (!i) {
|
||
throw new TypeError('Object is not iterable');
|
||
}
|
||
return o[Symbol_iterator_1.$$iterator]();
|
||
}
|
||
function toLength(o) {
|
||
var len = +o.length;
|
||
if (isNaN(len)) {
|
||
return 0;
|
||
}
|
||
if (len === 0 || !numberIsFinite(len)) {
|
||
return len;
|
||
}
|
||
len = sign(len) * Math.floor(Math.abs(len));
|
||
if (len <= 0) {
|
||
return 0;
|
||
}
|
||
if (len > maxSafeInteger) {
|
||
return maxSafeInteger;
|
||
}
|
||
return len;
|
||
}
|
||
function numberIsFinite(value) {
|
||
return typeof value === 'number' && root_1.root.isFinite(value);
|
||
}
|
||
function sign(value) {
|
||
var valueAsNumber = +value;
|
||
if (valueAsNumber === 0) {
|
||
return valueAsNumber;
|
||
}
|
||
if (isNaN(valueAsNumber)) {
|
||
return valueAsNumber;
|
||
}
|
||
return valueAsNumber < 0 ? -1 : 1;
|
||
}
|
||
//# sourceMappingURL=IteratorObservable.js.map
|
||
},{"../Observable":16,"../util/Symbol_iterator":140,"../util/errorObject":143,"../util/root":149,"../util/tryCatch":152}],34:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var Subscription_1 = require('../Subscription');
|
||
var immediate_1 = require('../schedulers/immediate');
|
||
var PromiseObservable = (function (_super) {
|
||
__extends(PromiseObservable, _super);
|
||
function PromiseObservable(promise, scheduler) {
|
||
if (scheduler === void 0) { scheduler = immediate_1.immediate; }
|
||
_super.call(this);
|
||
this.promise = promise;
|
||
this.scheduler = scheduler;
|
||
this._isScalar = false;
|
||
}
|
||
PromiseObservable.create = function (promise, scheduler) {
|
||
if (scheduler === void 0) { scheduler = immediate_1.immediate; }
|
||
return new PromiseObservable(promise, scheduler);
|
||
};
|
||
PromiseObservable.prototype._subscribe = function (subscriber) {
|
||
var _this = this;
|
||
var scheduler = this.scheduler;
|
||
var promise = this.promise;
|
||
if (scheduler === immediate_1.immediate) {
|
||
if (this._isScalar) {
|
||
subscriber.next(this.value);
|
||
subscriber.complete();
|
||
}
|
||
else {
|
||
promise.then(function (value) {
|
||
_this._isScalar = true;
|
||
_this.value = value;
|
||
subscriber.next(value);
|
||
subscriber.complete();
|
||
}, function (err) { return subscriber.error(err); })
|
||
.then(null, function (err) {
|
||
// escape the promise trap, throw unhandled errors
|
||
setTimeout(function () { throw err; });
|
||
});
|
||
}
|
||
}
|
||
else {
|
||
var subscription = new Subscription_1.Subscription();
|
||
if (this._isScalar) {
|
||
var value = this.value;
|
||
subscription.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber }));
|
||
}
|
||
else {
|
||
promise.then(function (value) {
|
||
_this._isScalar = true;
|
||
_this.value = value;
|
||
subscription.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber }));
|
||
}, function (err) { return subscription.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber })); })
|
||
.then(null, function (err) {
|
||
// escape the promise trap, throw unhandled errors
|
||
scheduler.schedule(function () { throw err; });
|
||
});
|
||
}
|
||
return subscription;
|
||
}
|
||
};
|
||
return PromiseObservable;
|
||
})(Observable_1.Observable);
|
||
exports.PromiseObservable = PromiseObservable;
|
||
function dispatchNext(_a) {
|
||
var value = _a.value, subscriber = _a.subscriber;
|
||
subscriber.next(value);
|
||
subscriber.complete();
|
||
}
|
||
function dispatchError(_a) {
|
||
var err = _a.err, subscriber = _a.subscriber;
|
||
subscriber.error(err);
|
||
}
|
||
//# sourceMappingURL=PromiseObservable.js.map
|
||
},{"../Observable":16,"../Subscription":21,"../schedulers/immediate":129}],35:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var RangeObservable = (function (_super) {
|
||
__extends(RangeObservable, _super);
|
||
function RangeObservable(start, end, scheduler) {
|
||
_super.call(this);
|
||
this.start = start;
|
||
this.end = end;
|
||
this.scheduler = scheduler;
|
||
}
|
||
RangeObservable.create = function (start, end, scheduler) {
|
||
if (start === void 0) { start = 0; }
|
||
if (end === void 0) { end = 0; }
|
||
return new RangeObservable(start, end, scheduler);
|
||
};
|
||
RangeObservable.dispatch = function (state) {
|
||
var start = state.start, index = state.index, end = state.end, subscriber = state.subscriber;
|
||
if (index >= end) {
|
||
subscriber.complete();
|
||
return;
|
||
}
|
||
subscriber.next(start);
|
||
if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
state.index = index + 1;
|
||
state.start = start + 1;
|
||
this.schedule(state);
|
||
};
|
||
RangeObservable.prototype._subscribe = function (subscriber) {
|
||
var index = 0;
|
||
var start = this.start;
|
||
var end = this.end;
|
||
var scheduler = this.scheduler;
|
||
if (scheduler) {
|
||
subscriber.add(scheduler.schedule(RangeObservable.dispatch, 0, {
|
||
index: index, end: end, start: start, subscriber: subscriber
|
||
}));
|
||
}
|
||
else {
|
||
do {
|
||
if (index++ >= end) {
|
||
subscriber.complete();
|
||
break;
|
||
}
|
||
subscriber.next(start++);
|
||
if (subscriber.isUnsubscribed) {
|
||
break;
|
||
}
|
||
} while (true);
|
||
}
|
||
};
|
||
return RangeObservable;
|
||
})(Observable_1.Observable);
|
||
exports.RangeObservable = RangeObservable;
|
||
//# sourceMappingURL=RangeObservable.js.map
|
||
},{"../Observable":16}],36:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var ErrorObservable_1 = require('./ErrorObservable');
|
||
var EmptyObservable_1 = require('./EmptyObservable');
|
||
var ScalarObservable = (function (_super) {
|
||
__extends(ScalarObservable, _super);
|
||
function ScalarObservable(value, scheduler) {
|
||
_super.call(this);
|
||
this.value = value;
|
||
this.scheduler = scheduler;
|
||
this._isScalar = true;
|
||
}
|
||
ScalarObservable.create = function (value, scheduler) {
|
||
return new ScalarObservable(value, scheduler);
|
||
};
|
||
ScalarObservable.dispatch = function (state) {
|
||
var done = state.done, value = state.value, subscriber = state.subscriber;
|
||
if (done) {
|
||
subscriber.complete();
|
||
return;
|
||
}
|
||
subscriber.next(value);
|
||
if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
state.done = true;
|
||
this.schedule(state);
|
||
};
|
||
ScalarObservable.prototype._subscribe = function (subscriber) {
|
||
var value = this.value;
|
||
var scheduler = this.scheduler;
|
||
if (scheduler) {
|
||
subscriber.add(scheduler.schedule(ScalarObservable.dispatch, 0, {
|
||
done: false, value: value, subscriber: subscriber
|
||
}));
|
||
}
|
||
else {
|
||
subscriber.next(value);
|
||
if (!subscriber.isUnsubscribed) {
|
||
subscriber.complete();
|
||
}
|
||
}
|
||
};
|
||
return ScalarObservable;
|
||
})(Observable_1.Observable);
|
||
exports.ScalarObservable = ScalarObservable;
|
||
// TypeScript is weird about class prototype member functions and instance properties touching on it's plate.
|
||
var proto = ScalarObservable.prototype;
|
||
proto.map = function (project, thisArg) {
|
||
var result = tryCatch_1.tryCatch(project).call(thisArg || this, this.value, 0);
|
||
if (result === errorObject_1.errorObject) {
|
||
return new ErrorObservable_1.ErrorObservable(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
return new ScalarObservable(project.call(thisArg || this, this.value, 0));
|
||
}
|
||
};
|
||
proto.filter = function (select, thisArg) {
|
||
var result = tryCatch_1.tryCatch(select).call(thisArg || this, this.value, 0);
|
||
if (result === errorObject_1.errorObject) {
|
||
return new ErrorObservable_1.ErrorObservable(errorObject_1.errorObject.e);
|
||
}
|
||
else if (result) {
|
||
return this;
|
||
}
|
||
else {
|
||
return new EmptyObservable_1.EmptyObservable();
|
||
}
|
||
};
|
||
proto.reduce = function (project, seed) {
|
||
if (typeof seed === 'undefined') {
|
||
return this;
|
||
}
|
||
var result = tryCatch_1.tryCatch(project)(seed, this.value);
|
||
if (result === errorObject_1.errorObject) {
|
||
return new ErrorObservable_1.ErrorObservable(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
return new ScalarObservable(result);
|
||
}
|
||
};
|
||
proto.scan = function (project, acc) {
|
||
return this.reduce(project, acc);
|
||
};
|
||
proto.count = function (predicate, thisArg) {
|
||
if (!predicate) {
|
||
return new ScalarObservable(1);
|
||
}
|
||
else {
|
||
var result = tryCatch_1.tryCatch(predicate).call(thisArg || this, this.value, 0, this);
|
||
if (result === errorObject_1.errorObject) {
|
||
return new ErrorObservable_1.ErrorObservable(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
return new ScalarObservable(result ? 1 : 0);
|
||
}
|
||
}
|
||
};
|
||
proto.skip = function (count) {
|
||
if (count > 0) {
|
||
return new EmptyObservable_1.EmptyObservable();
|
||
}
|
||
return this;
|
||
};
|
||
proto.take = function (count) {
|
||
if (count > 0) {
|
||
return this;
|
||
}
|
||
return new EmptyObservable_1.EmptyObservable();
|
||
};
|
||
//# sourceMappingURL=ScalarObservable.js.map
|
||
},{"../Observable":16,"../util/errorObject":143,"../util/tryCatch":152,"./EmptyObservable":25,"./ErrorObservable":26}],37:[function(require,module,exports){
|
||
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 Observable_1 = require('../Observable');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
var isNumeric_1 = require('../util/isNumeric');
|
||
var SubscribeOnObservable = (function (_super) {
|
||
__extends(SubscribeOnObservable, _super);
|
||
function SubscribeOnObservable(source, delayTime, scheduler) {
|
||
if (delayTime === void 0) { delayTime = 0; }
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
_super.call(this);
|
||
this.source = source;
|
||
this.delayTime = delayTime;
|
||
this.scheduler = scheduler;
|
||
if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) {
|
||
this.delayTime = 0;
|
||
}
|
||
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||
this.scheduler = nextTick_1.nextTick;
|
||
}
|
||
}
|
||
SubscribeOnObservable.create = function (source, delay, scheduler) {
|
||
if (delay === void 0) { delay = 0; }
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return new SubscribeOnObservable(source, delay, scheduler);
|
||
};
|
||
SubscribeOnObservable.dispatch = function (_a) {
|
||
var source = _a.source, subscriber = _a.subscriber;
|
||
return source.subscribe(subscriber);
|
||
};
|
||
SubscribeOnObservable.prototype._subscribe = function (subscriber) {
|
||
var delay = this.delayTime;
|
||
var source = this.source;
|
||
var scheduler = this.scheduler;
|
||
subscriber.add(scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
|
||
source: source, subscriber: subscriber
|
||
}));
|
||
};
|
||
return SubscribeOnObservable;
|
||
})(Observable_1.Observable);
|
||
exports.SubscribeOnObservable = SubscribeOnObservable;
|
||
//# sourceMappingURL=SubscribeOnObservable.js.map
|
||
},{"../Observable":16,"../schedulers/nextTick":130,"../util/isNumeric":145}],38:[function(require,module,exports){
|
||
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 isNumeric_1 = require('../util/isNumeric');
|
||
var Observable_1 = require('../Observable');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
var TimerObservable = (function (_super) {
|
||
__extends(TimerObservable, _super);
|
||
function TimerObservable(dueTime, period, scheduler) {
|
||
if (dueTime === void 0) { dueTime = 0; }
|
||
_super.call(this);
|
||
this.dueTime = dueTime;
|
||
this.period = period;
|
||
this.scheduler = scheduler;
|
||
if (isNumeric_1.isNumeric(period)) {
|
||
this._period = Number(period) < 1 && 1 || Number(period);
|
||
}
|
||
else if (period && typeof period.schedule === 'function') {
|
||
scheduler = period;
|
||
}
|
||
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||
scheduler = nextTick_1.nextTick;
|
||
}
|
||
this.scheduler = scheduler;
|
||
}
|
||
TimerObservable.create = function (dueTime, period, scheduler) {
|
||
if (dueTime === void 0) { dueTime = 0; }
|
||
return new TimerObservable(dueTime, period, scheduler);
|
||
};
|
||
TimerObservable.dispatch = function (state) {
|
||
var index = state.index, period = state.period, subscriber = state.subscriber;
|
||
var action = this;
|
||
subscriber.next(index);
|
||
if (typeof period === 'undefined') {
|
||
subscriber.complete();
|
||
return;
|
||
}
|
||
else if (subscriber.isUnsubscribed) {
|
||
return;
|
||
}
|
||
if (typeof action.delay === 'undefined') {
|
||
action.add(action.scheduler.schedule(TimerObservable.dispatch, period, {
|
||
index: index + 1, period: period, subscriber: subscriber
|
||
}));
|
||
}
|
||
else {
|
||
state.index = index + 1;
|
||
action.schedule(state, period);
|
||
}
|
||
};
|
||
TimerObservable.prototype._subscribe = function (subscriber) {
|
||
var index = 0;
|
||
var period = this._period;
|
||
var dueTime = this.dueTime;
|
||
var scheduler = this.scheduler;
|
||
subscriber.add(scheduler.schedule(TimerObservable.dispatch, dueTime, { index: index, period: period, subscriber: subscriber }));
|
||
};
|
||
return TimerObservable;
|
||
})(Observable_1.Observable);
|
||
exports.TimerObservable = TimerObservable;
|
||
//# sourceMappingURL=TimerObservable.js.map
|
||
},{"../Observable":16,"../schedulers/nextTick":130,"../util/isNumeric":145}],39:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
/**
|
||
* buffers the incoming observable values until the passed `closingNotifier` emits a value, at which point
|
||
* it emits the buffer on the returned observable and starts a new buffer internally, awaiting the
|
||
* next time `closingNotifier` emits
|
||
*
|
||
* @param {Observable<any>} closingNotifier an observable, that signals the buffer to be emitted} from the returned observable
|
||
* @returns {Observable<T[]>} an observable of buffers, which are arrays of values
|
||
*/
|
||
function buffer(closingNotifier) {
|
||
return this.lift(new BufferOperator(closingNotifier));
|
||
}
|
||
exports.buffer = buffer;
|
||
var BufferOperator = (function () {
|
||
function BufferOperator(closingNotifier) {
|
||
this.closingNotifier = closingNotifier;
|
||
}
|
||
BufferOperator.prototype.call = function (subscriber) {
|
||
return new BufferSubscriber(subscriber, this.closingNotifier);
|
||
};
|
||
return BufferOperator;
|
||
})();
|
||
var BufferSubscriber = (function (_super) {
|
||
__extends(BufferSubscriber, _super);
|
||
function BufferSubscriber(destination, closingNotifier) {
|
||
_super.call(this, destination);
|
||
this.buffer = [];
|
||
this.notifierSubscriber = null;
|
||
this.notifierSubscriber = new BufferClosingNotifierSubscriber(this);
|
||
this.add(closingNotifier._subscribe(this.notifierSubscriber));
|
||
}
|
||
BufferSubscriber.prototype._next = function (value) {
|
||
this.buffer.push(value);
|
||
};
|
||
BufferSubscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
BufferSubscriber.prototype._complete = function () {
|
||
this.destination.complete();
|
||
};
|
||
BufferSubscriber.prototype.flushBuffer = function () {
|
||
var buffer = this.buffer;
|
||
this.buffer = [];
|
||
this.destination.next(buffer);
|
||
if (this.isUnsubscribed) {
|
||
this.notifierSubscriber.unsubscribe();
|
||
}
|
||
};
|
||
return BufferSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var BufferClosingNotifierSubscriber = (function (_super) {
|
||
__extends(BufferClosingNotifierSubscriber, _super);
|
||
function BufferClosingNotifierSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
BufferClosingNotifierSubscriber.prototype._next = function (value) {
|
||
this.parent.flushBuffer();
|
||
};
|
||
BufferClosingNotifierSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
BufferClosingNotifierSubscriber.prototype._complete = function () {
|
||
this.parent.complete();
|
||
};
|
||
return BufferClosingNotifierSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=buffer.js.map
|
||
},{"../Subscriber":20}],40:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
/**
|
||
* buffers a number of values from the source observable by `bufferSize` then emits the buffer and clears it, and starts a
|
||
* new buffer each `startBufferEvery` values. If `startBufferEvery` is not provided or is `null`, then new buffers are
|
||
* started immediately at the start of the source and when each buffer closes and is emitted.
|
||
* @param {number} bufferSize the maximum size of the buffer emitted.
|
||
* @param {number} [startBufferEvery] optional interval at which to start a new buffer. (e.g. if `startBufferEvery` is `2`,asdf then a
|
||
* new buffer will be started on every other value from the source.) A new buffer is started at the beginning of the source by default.
|
||
* @returns {Observable<T[]>} an observable of arrays of buffered values.
|
||
*/
|
||
function bufferCount(bufferSize, startBufferEvery) {
|
||
if (startBufferEvery === void 0) { startBufferEvery = null; }
|
||
return this.lift(new BufferCountOperator(bufferSize, startBufferEvery));
|
||
}
|
||
exports.bufferCount = bufferCount;
|
||
var BufferCountOperator = (function () {
|
||
function BufferCountOperator(bufferSize, startBufferEvery) {
|
||
this.bufferSize = bufferSize;
|
||
this.startBufferEvery = startBufferEvery;
|
||
}
|
||
BufferCountOperator.prototype.call = function (subscriber) {
|
||
return new BufferCountSubscriber(subscriber, this.bufferSize, this.startBufferEvery);
|
||
};
|
||
return BufferCountOperator;
|
||
})();
|
||
var BufferCountSubscriber = (function (_super) {
|
||
__extends(BufferCountSubscriber, _super);
|
||
function BufferCountSubscriber(destination, bufferSize, startBufferEvery) {
|
||
_super.call(this, destination);
|
||
this.bufferSize = bufferSize;
|
||
this.startBufferEvery = startBufferEvery;
|
||
this.buffers = [[]];
|
||
this.count = 0;
|
||
}
|
||
BufferCountSubscriber.prototype._next = function (value) {
|
||
var count = (this.count += 1);
|
||
var destination = this.destination;
|
||
var bufferSize = this.bufferSize;
|
||
var startBufferEvery = (this.startBufferEvery == null) ? bufferSize : this.startBufferEvery;
|
||
var buffers = this.buffers;
|
||
var len = buffers.length;
|
||
var remove = -1;
|
||
if (count % startBufferEvery === 0) {
|
||
buffers.push([]);
|
||
}
|
||
for (var i = 0; i < len; i++) {
|
||
var buffer = buffers[i];
|
||
buffer.push(value);
|
||
if (buffer.length === bufferSize) {
|
||
remove = i;
|
||
destination.next(buffer);
|
||
}
|
||
}
|
||
if (remove !== -1) {
|
||
buffers.splice(remove, 1);
|
||
}
|
||
};
|
||
BufferCountSubscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
BufferCountSubscriber.prototype._complete = function () {
|
||
var destination = this.destination;
|
||
var buffers = this.buffers;
|
||
while (buffers.length > 0) {
|
||
var buffer = buffers.shift();
|
||
if (buffer.length > 0) {
|
||
destination.next(buffer);
|
||
}
|
||
}
|
||
destination.complete();
|
||
};
|
||
return BufferCountSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=bufferCount.js.map
|
||
},{"../Subscriber":20}],41:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
/**
|
||
* buffers values from the source for a specific time period. Optionally allows new buffers to be set up at an interval.
|
||
* @param {number} the amount of time to fill each buffer for before emitting them and clearing them.
|
||
* @param {number} [bufferCreationInterval] the interval at which to start new buffers.
|
||
* @param {Scheduler} [scheduler] (optional, defaults to `nextTick` scheduler) The scheduler on which to schedule the
|
||
* intervals that determine buffer boundaries.
|
||
* @returns {Observable<T[]>} an observable of arrays of buffered values.
|
||
*/
|
||
function bufferTime(bufferTimeSpan, bufferCreationInterval, scheduler) {
|
||
if (bufferCreationInterval === void 0) { bufferCreationInterval = null; }
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, scheduler));
|
||
}
|
||
exports.bufferTime = bufferTime;
|
||
var BufferTimeOperator = (function () {
|
||
function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, scheduler) {
|
||
this.bufferTimeSpan = bufferTimeSpan;
|
||
this.bufferCreationInterval = bufferCreationInterval;
|
||
this.scheduler = scheduler;
|
||
}
|
||
BufferTimeOperator.prototype.call = function (subscriber) {
|
||
return new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.scheduler);
|
||
};
|
||
return BufferTimeOperator;
|
||
})();
|
||
var BufferTimeSubscriber = (function (_super) {
|
||
__extends(BufferTimeSubscriber, _super);
|
||
function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, scheduler) {
|
||
_super.call(this, destination);
|
||
this.bufferTimeSpan = bufferTimeSpan;
|
||
this.bufferCreationInterval = bufferCreationInterval;
|
||
this.scheduler = scheduler;
|
||
this.buffers = [];
|
||
var buffer = this.openBuffer();
|
||
if (bufferCreationInterval !== null && bufferCreationInterval >= 0) {
|
||
var closeState = { subscriber: this, buffer: buffer };
|
||
var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler };
|
||
this.add(scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));
|
||
this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));
|
||
}
|
||
else {
|
||
var timeSpanOnlyState = { subscriber: this, buffer: buffer, bufferTimeSpan: bufferTimeSpan };
|
||
this.add(scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
|
||
}
|
||
}
|
||
BufferTimeSubscriber.prototype._next = function (value) {
|
||
var buffers = this.buffers;
|
||
var len = buffers.length;
|
||
for (var i = 0; i < len; i++) {
|
||
buffers[i].push(value);
|
||
}
|
||
};
|
||
BufferTimeSubscriber.prototype._error = function (err) {
|
||
this.buffers.length = 0;
|
||
this.destination.error(err);
|
||
};
|
||
BufferTimeSubscriber.prototype._complete = function () {
|
||
var buffers = this.buffers;
|
||
while (buffers.length > 0) {
|
||
this.destination.next(buffers.shift());
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
BufferTimeSubscriber.prototype.openBuffer = function () {
|
||
var buffer = [];
|
||
this.buffers.push(buffer);
|
||
return buffer;
|
||
};
|
||
BufferTimeSubscriber.prototype.closeBuffer = function (buffer) {
|
||
this.destination.next(buffer);
|
||
var buffers = this.buffers;
|
||
buffers.splice(buffers.indexOf(buffer), 1);
|
||
};
|
||
return BufferTimeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
function dispatchBufferTimeSpanOnly(state) {
|
||
var subscriber = state.subscriber;
|
||
var prevBuffer = state.buffer;
|
||
if (prevBuffer) {
|
||
subscriber.closeBuffer(prevBuffer);
|
||
}
|
||
state.buffer = subscriber.openBuffer();
|
||
if (!subscriber.isUnsubscribed) {
|
||
this.schedule(state, state.bufferTimeSpan);
|
||
}
|
||
}
|
||
function dispatchBufferCreation(state) {
|
||
var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler;
|
||
var buffer = subscriber.openBuffer();
|
||
var action = this;
|
||
if (!subscriber.isUnsubscribed) {
|
||
action.add(scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, buffer: buffer }));
|
||
action.schedule(state, bufferCreationInterval);
|
||
}
|
||
}
|
||
function dispatchBufferClose(_a) {
|
||
var subscriber = _a.subscriber, buffer = _a.buffer;
|
||
subscriber.closeBuffer(buffer);
|
||
}
|
||
//# sourceMappingURL=bufferTime.js.map
|
||
},{"../Subscriber":20,"../schedulers/nextTick":130}],42:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subscription_1 = require('../Subscription');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
/**
|
||
* buffers values from the source by opening the buffer via signals from an observable provided to `openings`, and closing
|
||
* and sending the buffers when an observable returned by the `closingSelector` emits.
|
||
* @param {Observable<O>} openings An observable of notifications to start new buffers
|
||
* @param {Function} an function, that takes the value emitted by the `openings` observable and returns an Observable, which,
|
||
* when it emits, signals that the associated buffer should be emitted and cleared.
|
||
* @returns {Observable<T[]>} an observable of arrays of buffered values.
|
||
*/
|
||
function bufferToggle(openings, closingSelector) {
|
||
return this.lift(new BufferToggleOperator(openings, closingSelector));
|
||
}
|
||
exports.bufferToggle = bufferToggle;
|
||
var BufferToggleOperator = (function () {
|
||
function BufferToggleOperator(openings, closingSelector) {
|
||
this.openings = openings;
|
||
this.closingSelector = closingSelector;
|
||
}
|
||
BufferToggleOperator.prototype.call = function (subscriber) {
|
||
return new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector);
|
||
};
|
||
return BufferToggleOperator;
|
||
})();
|
||
var BufferToggleSubscriber = (function (_super) {
|
||
__extends(BufferToggleSubscriber, _super);
|
||
function BufferToggleSubscriber(destination, openings, closingSelector) {
|
||
_super.call(this, destination);
|
||
this.openings = openings;
|
||
this.closingSelector = closingSelector;
|
||
this.contexts = [];
|
||
this.add(this.openings._subscribe(new BufferToggleOpeningsSubscriber(this)));
|
||
}
|
||
BufferToggleSubscriber.prototype._next = function (value) {
|
||
var contexts = this.contexts;
|
||
var len = contexts.length;
|
||
for (var i = 0; i < len; i++) {
|
||
contexts[i].buffer.push(value);
|
||
}
|
||
};
|
||
BufferToggleSubscriber.prototype._error = function (err) {
|
||
this.contexts = null;
|
||
this.destination.error(err);
|
||
};
|
||
BufferToggleSubscriber.prototype._complete = function () {
|
||
var contexts = this.contexts;
|
||
while (contexts.length > 0) {
|
||
var context = contexts.shift();
|
||
this.destination.next(context.buffer);
|
||
context.subscription.unsubscribe();
|
||
context.buffer = null;
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
BufferToggleSubscriber.prototype.openBuffer = function (value) {
|
||
var closingSelector = this.closingSelector;
|
||
var contexts = this.contexts;
|
||
var closingNotifier = tryCatch_1.tryCatch(closingSelector)(value);
|
||
if (closingNotifier === errorObject_1.errorObject) {
|
||
var err = closingNotifier.e;
|
||
this.contexts = null;
|
||
this.destination.error(err);
|
||
}
|
||
else {
|
||
var context = {
|
||
buffer: [],
|
||
subscription: new Subscription_1.Subscription()
|
||
};
|
||
contexts.push(context);
|
||
var subscriber = new BufferClosingNotifierSubscriber(this, context);
|
||
var subscription = closingNotifier._subscribe(subscriber);
|
||
this.add(context.subscription.add(subscription));
|
||
}
|
||
};
|
||
BufferToggleSubscriber.prototype.closeBuffer = function (context) {
|
||
var contexts = this.contexts;
|
||
if (contexts === null) {
|
||
return;
|
||
}
|
||
var buffer = context.buffer, subscription = context.subscription;
|
||
this.destination.next(buffer);
|
||
contexts.splice(contexts.indexOf(context), 1);
|
||
this.remove(subscription);
|
||
subscription.unsubscribe();
|
||
};
|
||
return BufferToggleSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var BufferClosingNotifierSubscriber = (function (_super) {
|
||
__extends(BufferClosingNotifierSubscriber, _super);
|
||
function BufferClosingNotifierSubscriber(parent, context) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
this.context = context;
|
||
}
|
||
BufferClosingNotifierSubscriber.prototype._next = function () {
|
||
this.parent.closeBuffer(this.context);
|
||
};
|
||
BufferClosingNotifierSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
BufferClosingNotifierSubscriber.prototype._complete = function () {
|
||
this.parent.closeBuffer(this.context);
|
||
};
|
||
return BufferClosingNotifierSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var BufferToggleOpeningsSubscriber = (function (_super) {
|
||
__extends(BufferToggleOpeningsSubscriber, _super);
|
||
function BufferToggleOpeningsSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
BufferToggleOpeningsSubscriber.prototype._next = function (value) {
|
||
this.parent.openBuffer(value);
|
||
};
|
||
BufferToggleOpeningsSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
BufferToggleOpeningsSubscriber.prototype._complete = function () {
|
||
// noop
|
||
};
|
||
return BufferToggleOpeningsSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=bufferToggle.js.map
|
||
},{"../Subscriber":20,"../Subscription":21,"../util/errorObject":143,"../util/tryCatch":152}],43:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
/**
|
||
* Opens a buffer immediately, then closes the buffer when the observable returned by calling `closingSelector` emits a value.
|
||
* It that immediately opens a new buffer and repeats the process
|
||
* @param {function} a function that takes no arguments and returns an Observable that signals buffer closure
|
||
* @returns {Observable<T[]>} an observable of arrays of buffered values.
|
||
*/
|
||
function bufferWhen(closingSelector) {
|
||
return this.lift(new BufferWhenOperator(closingSelector));
|
||
}
|
||
exports.bufferWhen = bufferWhen;
|
||
var BufferWhenOperator = (function () {
|
||
function BufferWhenOperator(closingSelector) {
|
||
this.closingSelector = closingSelector;
|
||
}
|
||
BufferWhenOperator.prototype.call = function (subscriber) {
|
||
return new BufferWhenSubscriber(subscriber, this.closingSelector);
|
||
};
|
||
return BufferWhenOperator;
|
||
})();
|
||
var BufferWhenSubscriber = (function (_super) {
|
||
__extends(BufferWhenSubscriber, _super);
|
||
function BufferWhenSubscriber(destination, closingSelector) {
|
||
_super.call(this, destination);
|
||
this.closingSelector = closingSelector;
|
||
this.openBuffer();
|
||
}
|
||
BufferWhenSubscriber.prototype._next = function (value) {
|
||
this.buffer.push(value);
|
||
};
|
||
BufferWhenSubscriber.prototype._error = function (err) {
|
||
this.buffer = null;
|
||
this.destination.error(err);
|
||
};
|
||
BufferWhenSubscriber.prototype._complete = function () {
|
||
var buffer = this.buffer;
|
||
this.destination.next(buffer);
|
||
this.buffer = null;
|
||
this.destination.complete();
|
||
};
|
||
BufferWhenSubscriber.prototype.openBuffer = function () {
|
||
var prevClosingNotification = this.closingNotification;
|
||
if (prevClosingNotification) {
|
||
this.remove(prevClosingNotification);
|
||
prevClosingNotification.unsubscribe();
|
||
}
|
||
var buffer = this.buffer;
|
||
if (buffer) {
|
||
this.destination.next(buffer);
|
||
}
|
||
this.buffer = [];
|
||
var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)();
|
||
if (closingNotifier === errorObject_1.errorObject) {
|
||
var err = closingNotifier.e;
|
||
this.buffer = null;
|
||
this.destination.error(err);
|
||
}
|
||
else {
|
||
this.add(this.closingNotification = closingNotifier._subscribe(new BufferClosingNotifierSubscriber(this)));
|
||
}
|
||
};
|
||
return BufferWhenSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var BufferClosingNotifierSubscriber = (function (_super) {
|
||
__extends(BufferClosingNotifierSubscriber, _super);
|
||
function BufferClosingNotifierSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
BufferClosingNotifierSubscriber.prototype._next = function () {
|
||
this.parent.openBuffer();
|
||
};
|
||
BufferClosingNotifierSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
BufferClosingNotifierSubscriber.prototype._complete = function () {
|
||
this.parent.openBuffer();
|
||
};
|
||
return BufferClosingNotifierSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=bufferWhen.js.map
|
||
},{"../Subscriber":20,"../util/errorObject":143,"../util/tryCatch":152}],44:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
/**
|
||
* Catches errors on the observable to be handled by returning a new observable or throwing an error.
|
||
* @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which
|
||
* is the source observable, in case you'd like to "retry" that observable by returning it again. Whatever observable
|
||
* is returned by the `selector` will be used to continue the observable chain.
|
||
* @return {Observable} an observable that originates from either the source or the observable returned by the
|
||
* catch `selector` function.
|
||
*/
|
||
function _catch(selector) {
|
||
var catchOperator = new CatchOperator(selector);
|
||
var caught = this.lift(catchOperator);
|
||
catchOperator.caught = caught;
|
||
return caught;
|
||
}
|
||
exports._catch = _catch;
|
||
var CatchOperator = (function () {
|
||
function CatchOperator(selector) {
|
||
this.selector = selector;
|
||
}
|
||
CatchOperator.prototype.call = function (subscriber) {
|
||
return new CatchSubscriber(subscriber, this.selector, this.caught);
|
||
};
|
||
return CatchOperator;
|
||
})();
|
||
var CatchSubscriber = (function (_super) {
|
||
__extends(CatchSubscriber, _super);
|
||
function CatchSubscriber(destination, selector, caught) {
|
||
_super.call(this, destination);
|
||
this.selector = selector;
|
||
this.caught = caught;
|
||
}
|
||
CatchSubscriber.prototype._error = function (err) {
|
||
var result = tryCatch_1.tryCatch(this.selector)(err, this.caught);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.add(result.subscribe(this.destination));
|
||
}
|
||
};
|
||
return CatchSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=catch.js.map
|
||
},{"../Subscriber":20,"../util/errorObject":143,"../util/tryCatch":152}],45:[function(require,module,exports){
|
||
var combineLatest_support_1 = require('./combineLatest-support');
|
||
/**
|
||
* Takes an Observable of Observables, and collects all observables from it. Once the outer observable
|
||
* completes, it subscribes to all collected observables and "combines" their values, such that:
|
||
* - every time an observable emits, the returned observable emits
|
||
* - when the returned observable emits, it emits all of the most recent values by:
|
||
* - if a `project` function is provided, it is called with each recent value from each observable in whatever order they arrived,
|
||
* and the result of the `project` function is what is emitted by the returned observable
|
||
* - if there is no `project` function, an array of all of the most recent values is emitted by the returned observable.
|
||
* @param {function} [project] an optional function to map the most recent values from each observable into a new result. Takes each of the
|
||
* most recent values from each collected observable as arguments, in order.
|
||
* @returns {Observable} an observable of projected results or arrays of recent values.
|
||
*/
|
||
function combineAll(project) {
|
||
return this.lift(new combineLatest_support_1.CombineLatestOperator(project));
|
||
}
|
||
exports.combineAll = combineAll;
|
||
//# sourceMappingURL=combineAll.js.map
|
||
},{"./combineLatest-support":47}],46:[function(require,module,exports){
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
var combineLatest_support_1 = require('./combineLatest-support');
|
||
/**
|
||
* Combines the values from observables passed as arguments. This is done by subscribing
|
||
* to each observable, in order, and collecting an array of each of the most recent values any time any of the observables
|
||
* emits, then either taking that array and passing it as arguments to an option `project` function and emitting the return
|
||
* value of that, or just emitting the array of recent values directly if there is no `project` function.
|
||
* @param {...Observable} observables the observables to combine
|
||
* @param {function} [project] an optional function to project the values from the combined recent values into a new value for emission.
|
||
* @returns {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of
|
||
* the most recent values from each observable.
|
||
*/
|
||
function combineLatest() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
var project, scheduler;
|
||
if (typeof observables[observables.length - 1].schedule === 'function') {
|
||
scheduler = observables.pop();
|
||
}
|
||
if (typeof observables[observables.length - 1] === 'function') {
|
||
project = observables.pop();
|
||
}
|
||
return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_support_1.CombineLatestOperator(project));
|
||
}
|
||
exports.combineLatest = combineLatest;
|
||
//# sourceMappingURL=combineLatest-static.js.map
|
||
},{"../observables/ArrayObservable":22,"./combineLatest-support":47}],47:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
var CombineLatestOperator = (function () {
|
||
function CombineLatestOperator(project) {
|
||
this.project = project;
|
||
}
|
||
CombineLatestOperator.prototype.call = function (subscriber) {
|
||
return new CombineLatestSubscriber(subscriber, this.project);
|
||
};
|
||
return CombineLatestOperator;
|
||
})();
|
||
exports.CombineLatestOperator = CombineLatestOperator;
|
||
var CombineLatestSubscriber = (function (_super) {
|
||
__extends(CombineLatestSubscriber, _super);
|
||
function CombineLatestSubscriber(destination, project) {
|
||
_super.call(this, destination);
|
||
this.project = project;
|
||
this.active = 0;
|
||
this.values = [];
|
||
this.observables = [];
|
||
this.toRespond = [];
|
||
}
|
||
CombineLatestSubscriber.prototype._next = function (observable) {
|
||
var toRespond = this.toRespond;
|
||
toRespond.push(toRespond.length);
|
||
this.observables.push(observable);
|
||
};
|
||
CombineLatestSubscriber.prototype._complete = function () {
|
||
var observables = this.observables;
|
||
var len = observables.length;
|
||
if (len === 0) {
|
||
this.destination.complete();
|
||
}
|
||
else {
|
||
this.active = len;
|
||
for (var i = 0; i < len; i++) {
|
||
var observable = observables[i];
|
||
this.add(subscribeToResult_1.subscribeToResult(this, observable, observable, i));
|
||
}
|
||
}
|
||
};
|
||
CombineLatestSubscriber.prototype.notifyComplete = function (innerSubscriber) {
|
||
if ((this.active -= 1) === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
CombineLatestSubscriber.prototype.notifyNext = function (observable, value, outerIndex, innerIndex) {
|
||
var values = this.values;
|
||
values[outerIndex] = value;
|
||
var toRespond = this.toRespond;
|
||
if (toRespond.length > 0) {
|
||
var found = toRespond.indexOf(outerIndex);
|
||
if (found !== -1) {
|
||
toRespond.splice(found, 1);
|
||
}
|
||
}
|
||
if (toRespond.length === 0) {
|
||
var project = this.project;
|
||
var destination = this.destination;
|
||
if (project) {
|
||
var result = tryCatch_1.tryCatch(project).apply(this, values);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(values);
|
||
}
|
||
}
|
||
};
|
||
return CombineLatestSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
exports.CombineLatestSubscriber = CombineLatestSubscriber;
|
||
//# sourceMappingURL=combineLatest-support.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],48:[function(require,module,exports){
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
var combineLatest_support_1 = require('./combineLatest-support');
|
||
/**
|
||
* Combines the values from this observable with values from observables passed as arguments. This is done by subscribing
|
||
* to each observable, in order, and collecting an array of each of the most recent values any time any of the observables
|
||
* emits, then either taking that array and passing it as arguments to an option `project` function and emitting the return
|
||
* value of that, or just emitting the array of recent values directly if there is no `project` function.
|
||
* @param {...Observable} observables the observables to combine the source with
|
||
* @param {function} [project] an optional function to project the values from the combined recent values into a new value for emission.
|
||
* @returns {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of
|
||
* the most recent values from each observable.
|
||
*/
|
||
function combineLatest() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
observables.unshift(this);
|
||
var project;
|
||
if (typeof observables[observables.length - 1] === 'function') {
|
||
project = observables.pop();
|
||
}
|
||
return new ArrayObservable_1.ArrayObservable(observables).lift(new combineLatest_support_1.CombineLatestOperator(project));
|
||
}
|
||
exports.combineLatest = combineLatest;
|
||
//# sourceMappingURL=combineLatest.js.map
|
||
},{"../observables/ArrayObservable":22,"./combineLatest-support":47}],49:[function(require,module,exports){
|
||
var immediate_1 = require('../schedulers/immediate');
|
||
var mergeAll_support_1 = require('./mergeAll-support');
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
/**
|
||
* Joins multiple observables together by subscribing to them one at a time and merging their results
|
||
* into the returned observable. Will wait for each observable to complete before moving on to the next.
|
||
* @params {...Observable} the observables to concatenate
|
||
* @params {Scheduler} [scheduler] an optional scheduler to schedule each observable subscription on.
|
||
* @returns {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion.
|
||
*/
|
||
function concat() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
var scheduler = immediate_1.immediate;
|
||
var args = observables;
|
||
if (typeof (args[observables.length - 1]).schedule === 'function') {
|
||
scheduler = args.pop();
|
||
}
|
||
return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new mergeAll_support_1.MergeAllOperator(1));
|
||
}
|
||
exports.concat = concat;
|
||
//# sourceMappingURL=concat-static.js.map
|
||
},{"../observables/ArrayObservable":22,"../schedulers/immediate":129,"./mergeAll-support":77}],50:[function(require,module,exports){
|
||
var Observable_1 = require('../Observable');
|
||
/**
|
||
* Joins this observable with multiple other observables by subscribing to them one at a time, starting with the source,
|
||
* and merging their results into the returned observable. Will wait for each observable to complete before moving
|
||
* on to the next.
|
||
* @params {...Observable} the observables to concatenate
|
||
* @params {Scheduler} [scheduler] an optional scheduler to schedule each observable subscription on.
|
||
* @returns {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion.
|
||
*/
|
||
function concat() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
var args = observables;
|
||
args.unshift(this);
|
||
if (args.length > 1 && typeof args[args.length - 1].schedule === 'function') {
|
||
args.splice(args.length - 2, 0, 1);
|
||
}
|
||
return Observable_1.Observable.fromArray(args).mergeAll(1);
|
||
}
|
||
exports.concat = concat;
|
||
//# sourceMappingURL=concat.js.map
|
||
},{"../Observable":16}],51:[function(require,module,exports){
|
||
var mergeAll_support_1 = require('./mergeAll-support');
|
||
/**
|
||
* Joins every Observable emitted by the source (an Observable of Observables), in a serial
|
||
* fashion. Subscribing to each one only when the previous one has completed, and merging
|
||
* all of their values into the returned observable.
|
||
*
|
||
* __Warning:__ If the source Observable emits Observables quickly and endlessly, and the
|
||
* Observables it emits generally complete slower than the source emits, you can run into
|
||
* memory issues as the incoming observables collect in an unbounded buffer.
|
||
*
|
||
* @returns {Observable} an observable of values merged from the incoming observables.
|
||
*/
|
||
function concatAll() {
|
||
return this.lift(new mergeAll_support_1.MergeAllOperator(1));
|
||
}
|
||
exports.concatAll = concatAll;
|
||
//# sourceMappingURL=concatAll.js.map
|
||
},{"./mergeAll-support":77}],52:[function(require,module,exports){
|
||
var mergeMap_support_1 = require('./mergeMap-support');
|
||
/**
|
||
* Maps values from the source observable into new Observables, then merges them in a serialized fashion,
|
||
* waiting for each one to complete before merging the next.
|
||
*
|
||
* __Warning:__ if incoming values arrive endlessly and faster than the observables they're being mapped
|
||
* to can complete, it will result in memory issues as created observables amass in an unbounded buffer
|
||
* waiting for their turn to be subscribed to.
|
||
*
|
||
* @param {function} project a function to map incoming values into Observables to be concatenated. accepts
|
||
* the `value` and the `index` as arguments.
|
||
* @param {function} [projectResult] an optional result selector that is applied to values before they're
|
||
* merged into the returned observable. The arguments passed to this function are:
|
||
* - `outerValue`: the value that came from the source
|
||
* - `innerValue`: the value that came from the projected Observable
|
||
* - `outerIndex`: the "index" of the value that came from the source
|
||
* - `innerIndex`: the "index" of the value from the projected Observable
|
||
* @returns {Observable} an observable of values merged from the projected Observables as they were subscribed to,
|
||
* one at a time. Optionally, these values may have been projected from a passed `projectResult` argument.
|
||
*/
|
||
function concatMap(project, projectResult) {
|
||
return this.lift(new mergeMap_support_1.MergeMapOperator(project, projectResult, 1));
|
||
}
|
||
exports.concatMap = concatMap;
|
||
//# sourceMappingURL=concatMap.js.map
|
||
},{"./mergeMap-support":79}],53:[function(require,module,exports){
|
||
var mergeMapTo_support_1 = require('./mergeMapTo-support');
|
||
/**
|
||
* Maps values from the source to a specific observable, and merges them together in a serialized fashion.
|
||
*
|
||
* @param {Observable} observable the observable to map each source value to
|
||
* @param {function} [projectResult] an optional result selector that is applied to values before they're
|
||
* merged into the returned observable. The arguments passed to this function are:
|
||
* - `outerValue`: the value that came from the source
|
||
* - `innerValue`: the value that came from the projected Observable
|
||
* - `outerIndex`: the "index" of the value that came from the source
|
||
* - `innerIndex`: the "index" of the value from the projected Observable
|
||
* @returns {Observable} an observable of values merged together by joining the passed observable
|
||
* with itself, one after the other, for each value emitted from the source.
|
||
*/
|
||
function concatMapTo(observable, projectResult) {
|
||
return this.lift(new mergeMapTo_support_1.MergeMapToOperator(observable, projectResult, 1));
|
||
}
|
||
exports.concatMapTo = concatMapTo;
|
||
//# sourceMappingURL=concatMapTo.js.map
|
||
},{"./mergeMapTo-support":81}],54:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
/**
|
||
* Returns an observable of a single number that represents the number of items that either:
|
||
* Match a provided predicate function, _or_ if a predicate is not provided, the number
|
||
* represents the total count of all items in the source observable. The count is emitted
|
||
* by the returned observable when the source observable completes.
|
||
* @param {function} [predicate] a boolean function to select what values are to be counted.
|
||
* it is provided with arguments of:
|
||
* - `value`: the value from the source observable
|
||
* - `index`: the "index" of the value from the source observable
|
||
* - `source`: the source observable instance itself.
|
||
* @param {any} [thisArg] the optional `this` context to use in the `predicate` function
|
||
* @returns {Observable} an observable of one number that represents the count as described
|
||
* above
|
||
*/
|
||
function count(predicate, thisArg) {
|
||
return this.lift(new CountOperator(predicate, thisArg, this));
|
||
}
|
||
exports.count = count;
|
||
var CountOperator = (function () {
|
||
function CountOperator(predicate, thisArg, source) {
|
||
this.predicate = predicate;
|
||
this.thisArg = thisArg;
|
||
this.source = source;
|
||
}
|
||
CountOperator.prototype.call = function (subscriber) {
|
||
return new CountSubscriber(subscriber, this.predicate, this.thisArg, this.source);
|
||
};
|
||
return CountOperator;
|
||
})();
|
||
var CountSubscriber = (function (_super) {
|
||
__extends(CountSubscriber, _super);
|
||
function CountSubscriber(destination, predicate, thisArg, source) {
|
||
_super.call(this, destination);
|
||
this.thisArg = thisArg;
|
||
this.source = source;
|
||
this.count = 0;
|
||
this.index = 0;
|
||
if (typeof predicate === 'function') {
|
||
this.predicate = bindCallback_1.bindCallback(predicate, thisArg, 3);
|
||
}
|
||
}
|
||
CountSubscriber.prototype._next = function (value) {
|
||
var predicate = this.predicate;
|
||
var passed = true;
|
||
if (predicate) {
|
||
passed = tryCatch_1.tryCatch(predicate)(value, this.index++, this.source);
|
||
if (passed === errorObject_1.errorObject) {
|
||
this.destination.error(passed.e);
|
||
return;
|
||
}
|
||
}
|
||
if (passed) {
|
||
this.count += 1;
|
||
}
|
||
};
|
||
CountSubscriber.prototype._complete = function () {
|
||
this.destination.next(this.count);
|
||
this.destination.complete();
|
||
};
|
||
return CountSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=count.js.map
|
||
},{"../Subscriber":20,"../util/bindCallback":142,"../util/errorObject":143,"../util/tryCatch":152}],55:[function(require,module,exports){
|
||
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 PromiseObservable_1 = require('../observables/PromiseObservable');
|
||
var Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var isPromise_1 = require('../util/isPromise');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function debounce(durationSelector) {
|
||
return this.lift(new DebounceOperator(durationSelector));
|
||
}
|
||
exports.debounce = debounce;
|
||
var DebounceOperator = (function () {
|
||
function DebounceOperator(durationSelector) {
|
||
this.durationSelector = durationSelector;
|
||
}
|
||
DebounceOperator.prototype.call = function (observer) {
|
||
return new DebounceSubscriber(observer, this.durationSelector);
|
||
};
|
||
return DebounceOperator;
|
||
})();
|
||
var DebounceSubscriber = (function (_super) {
|
||
__extends(DebounceSubscriber, _super);
|
||
function DebounceSubscriber(destination, durationSelector) {
|
||
_super.call(this, destination);
|
||
this.durationSelector = durationSelector;
|
||
this.debouncedSubscription = null;
|
||
this.lastValue = null;
|
||
this._index = 0;
|
||
}
|
||
Object.defineProperty(DebounceSubscriber.prototype, "index", {
|
||
get: function () {
|
||
return this._index;
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
DebounceSubscriber.prototype._next = function (value) {
|
||
var destination = this.destination;
|
||
var currentIndex = ++this._index;
|
||
var debounce = tryCatch_1.tryCatch(this.durationSelector)(value);
|
||
if (debounce === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
if (isPromise_1.isPromise(debounce)) {
|
||
debounce = PromiseObservable_1.PromiseObservable.create(debounce);
|
||
}
|
||
this.lastValue = value;
|
||
this.add(this.debouncedSubscription = debounce._subscribe(new DurationSelectorSubscriber(this, currentIndex)));
|
||
}
|
||
};
|
||
DebounceSubscriber.prototype._complete = function () {
|
||
this.debouncedNext();
|
||
this.destination.complete();
|
||
};
|
||
DebounceSubscriber.prototype.debouncedNext = function () {
|
||
this.clearDebounce();
|
||
if (this.lastValue != null) {
|
||
this.destination.next(this.lastValue);
|
||
this.lastValue = null;
|
||
}
|
||
};
|
||
DebounceSubscriber.prototype.clearDebounce = function () {
|
||
var debouncedSubscription = this.debouncedSubscription;
|
||
if (debouncedSubscription !== null) {
|
||
this.remove(debouncedSubscription);
|
||
this.debouncedSubscription = null;
|
||
}
|
||
};
|
||
return DebounceSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var DurationSelectorSubscriber = (function (_super) {
|
||
__extends(DurationSelectorSubscriber, _super);
|
||
function DurationSelectorSubscriber(parent, currentIndex) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
this.currentIndex = currentIndex;
|
||
}
|
||
DurationSelectorSubscriber.prototype.debounceNext = function () {
|
||
var parent = this.parent;
|
||
if (this.currentIndex === parent.index) {
|
||
parent.debouncedNext();
|
||
if (!this.isUnsubscribed) {
|
||
this.unsubscribe();
|
||
}
|
||
}
|
||
};
|
||
DurationSelectorSubscriber.prototype._next = function (unused) {
|
||
this.debounceNext();
|
||
};
|
||
DurationSelectorSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
DurationSelectorSubscriber.prototype._complete = function () {
|
||
this.debounceNext();
|
||
};
|
||
return DurationSelectorSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=debounce.js.map
|
||
},{"../Subscriber":20,"../observables/PromiseObservable":34,"../util/errorObject":143,"../util/isPromise":146,"../util/tryCatch":152}],56:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
function debounceTime(dueTime, scheduler) {
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return this.lift(new DebounceTimeOperator(dueTime, scheduler));
|
||
}
|
||
exports.debounceTime = debounceTime;
|
||
var DebounceTimeOperator = (function () {
|
||
function DebounceTimeOperator(dueTime, scheduler) {
|
||
this.dueTime = dueTime;
|
||
this.scheduler = scheduler;
|
||
}
|
||
DebounceTimeOperator.prototype.call = function (subscriber) {
|
||
return new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler);
|
||
};
|
||
return DebounceTimeOperator;
|
||
})();
|
||
var DebounceTimeSubscriber = (function (_super) {
|
||
__extends(DebounceTimeSubscriber, _super);
|
||
function DebounceTimeSubscriber(destination, dueTime, scheduler) {
|
||
_super.call(this, destination);
|
||
this.dueTime = dueTime;
|
||
this.scheduler = scheduler;
|
||
this.debouncedSubscription = null;
|
||
this.lastValue = null;
|
||
}
|
||
DebounceTimeSubscriber.prototype._next = function (value) {
|
||
this.clearDebounce();
|
||
this.lastValue = value;
|
||
this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));
|
||
};
|
||
DebounceTimeSubscriber.prototype._complete = function () {
|
||
this.debouncedNext();
|
||
this.destination.complete();
|
||
};
|
||
DebounceTimeSubscriber.prototype.debouncedNext = function () {
|
||
this.clearDebounce();
|
||
if (this.lastValue != null) {
|
||
this.destination.next(this.lastValue);
|
||
this.lastValue = null;
|
||
}
|
||
};
|
||
DebounceTimeSubscriber.prototype.clearDebounce = function () {
|
||
var debouncedSubscription = this.debouncedSubscription;
|
||
if (debouncedSubscription !== null) {
|
||
this.remove(debouncedSubscription);
|
||
debouncedSubscription.unsubscribe();
|
||
this.debouncedSubscription = null;
|
||
}
|
||
};
|
||
return DebounceTimeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
function dispatchNext(subscriber) {
|
||
subscriber.debouncedNext();
|
||
}
|
||
//# sourceMappingURL=debounceTime.js.map
|
||
},{"../Subscriber":20,"../schedulers/nextTick":130}],57:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function defaultIfEmpty(defaultValue) {
|
||
if (defaultValue === void 0) { defaultValue = null; }
|
||
return this.lift(new DefaultIfEmptyOperator(defaultValue));
|
||
}
|
||
exports.defaultIfEmpty = defaultIfEmpty;
|
||
var DefaultIfEmptyOperator = (function () {
|
||
function DefaultIfEmptyOperator(defaultValue) {
|
||
this.defaultValue = defaultValue;
|
||
}
|
||
DefaultIfEmptyOperator.prototype.call = function (subscriber) {
|
||
return new DefaultIfEmptySubscriber(subscriber, this.defaultValue);
|
||
};
|
||
return DefaultIfEmptyOperator;
|
||
})();
|
||
var DefaultIfEmptySubscriber = (function (_super) {
|
||
__extends(DefaultIfEmptySubscriber, _super);
|
||
function DefaultIfEmptySubscriber(destination, defaultValue) {
|
||
_super.call(this, destination);
|
||
this.defaultValue = defaultValue;
|
||
this.isEmpty = true;
|
||
}
|
||
DefaultIfEmptySubscriber.prototype._next = function (x) {
|
||
this.isEmpty = false;
|
||
this.destination.next(x);
|
||
};
|
||
DefaultIfEmptySubscriber.prototype._complete = function () {
|
||
if (this.isEmpty) {
|
||
this.destination.next(this.defaultValue);
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
return DefaultIfEmptySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=defaultIfEmpty.js.map
|
||
},{"../Subscriber":20}],58:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Notification_1 = require('../Notification');
|
||
var immediate_1 = require('../schedulers/immediate');
|
||
var isDate_1 = require('../util/isDate');
|
||
function delay(delay, scheduler) {
|
||
if (scheduler === void 0) { scheduler = immediate_1.immediate; }
|
||
var absoluteDelay = isDate_1.isDate(delay);
|
||
var delayFor = absoluteDelay ? (+delay - scheduler.now()) : delay;
|
||
return this.lift(new DelayOperator(delayFor, scheduler));
|
||
}
|
||
exports.delay = delay;
|
||
var DelayOperator = (function () {
|
||
function DelayOperator(delay, scheduler) {
|
||
this.delay = delay;
|
||
this.scheduler = scheduler;
|
||
}
|
||
DelayOperator.prototype.call = function (subscriber) {
|
||
return new DelaySubscriber(subscriber, this.delay, this.scheduler);
|
||
};
|
||
return DelayOperator;
|
||
})();
|
||
var DelaySubscriber = (function (_super) {
|
||
__extends(DelaySubscriber, _super);
|
||
function DelaySubscriber(destination, delay, scheduler) {
|
||
_super.call(this, destination);
|
||
this.delay = delay;
|
||
this.scheduler = scheduler;
|
||
this.queue = [];
|
||
this.active = false;
|
||
this.errored = false;
|
||
}
|
||
DelaySubscriber.dispatch = function (state) {
|
||
var source = state.source;
|
||
var queue = source.queue;
|
||
var scheduler = state.scheduler;
|
||
var destination = state.destination;
|
||
while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
|
||
queue.shift().notification.observe(destination);
|
||
}
|
||
if (queue.length > 0) {
|
||
var delay_1 = Math.max(0, queue[0].time - scheduler.now());
|
||
this.schedule(state, delay_1);
|
||
}
|
||
else {
|
||
source.active = false;
|
||
}
|
||
};
|
||
DelaySubscriber.prototype._schedule = function (scheduler) {
|
||
this.active = true;
|
||
this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
|
||
source: this, destination: this.destination, scheduler: scheduler
|
||
}));
|
||
};
|
||
DelaySubscriber.prototype.scheduleNotification = function (notification) {
|
||
if (this.errored === true) {
|
||
return;
|
||
}
|
||
var scheduler = this.scheduler;
|
||
var message = new DelayMessage(scheduler.now() + this.delay, notification);
|
||
this.queue.push(message);
|
||
if (this.active === false) {
|
||
this._schedule(scheduler);
|
||
}
|
||
};
|
||
DelaySubscriber.prototype._next = function (value) {
|
||
this.scheduleNotification(Notification_1.Notification.createNext(value));
|
||
};
|
||
DelaySubscriber.prototype._error = function (err) {
|
||
this.errored = true;
|
||
this.queue = [];
|
||
this.destination.error(err);
|
||
};
|
||
DelaySubscriber.prototype._complete = function () {
|
||
this.scheduleNotification(Notification_1.Notification.createComplete());
|
||
};
|
||
return DelaySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var DelayMessage = (function () {
|
||
function DelayMessage(time, notification) {
|
||
this.time = time;
|
||
this.notification = notification;
|
||
}
|
||
return DelayMessage;
|
||
})();
|
||
//# sourceMappingURL=delay.js.map
|
||
},{"../Notification":15,"../Subscriber":20,"../schedulers/immediate":129,"../util/isDate":144}],59:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function dematerialize() {
|
||
return this.lift(new DeMaterializeOperator());
|
||
}
|
||
exports.dematerialize = dematerialize;
|
||
var DeMaterializeOperator = (function () {
|
||
function DeMaterializeOperator() {
|
||
}
|
||
DeMaterializeOperator.prototype.call = function (subscriber) {
|
||
return new DeMaterializeSubscriber(subscriber);
|
||
};
|
||
return DeMaterializeOperator;
|
||
})();
|
||
var DeMaterializeSubscriber = (function (_super) {
|
||
__extends(DeMaterializeSubscriber, _super);
|
||
function DeMaterializeSubscriber(destination) {
|
||
_super.call(this, destination);
|
||
}
|
||
DeMaterializeSubscriber.prototype._next = function (value) {
|
||
value.observe(this.destination);
|
||
};
|
||
return DeMaterializeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=dematerialize.js.map
|
||
},{"../Subscriber":20}],60:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
function distinctUntilChanged(compare, thisArg) {
|
||
return this.lift(new DistinctUntilChangedOperator(thisArg ?
|
||
bindCallback_1.bindCallback(compare, thisArg, 2) :
|
||
compare));
|
||
}
|
||
exports.distinctUntilChanged = distinctUntilChanged;
|
||
var DistinctUntilChangedOperator = (function () {
|
||
function DistinctUntilChangedOperator(compare) {
|
||
this.compare = compare;
|
||
}
|
||
DistinctUntilChangedOperator.prototype.call = function (subscriber) {
|
||
return new DistinctUntilChangedSubscriber(subscriber, this.compare);
|
||
};
|
||
return DistinctUntilChangedOperator;
|
||
})();
|
||
var DistinctUntilChangedSubscriber = (function (_super) {
|
||
__extends(DistinctUntilChangedSubscriber, _super);
|
||
function DistinctUntilChangedSubscriber(destination, compare) {
|
||
_super.call(this, destination);
|
||
this.hasValue = false;
|
||
if (typeof compare === 'function') {
|
||
this.compare = compare;
|
||
}
|
||
}
|
||
DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
|
||
return x === y;
|
||
};
|
||
DistinctUntilChangedSubscriber.prototype._next = function (x) {
|
||
var result = false;
|
||
if (this.hasValue) {
|
||
result = tryCatch_1.tryCatch(this.compare)(this.value, x);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
return;
|
||
}
|
||
}
|
||
else {
|
||
this.hasValue = true;
|
||
}
|
||
if (Boolean(result) === false) {
|
||
this.value = x;
|
||
this.destination.next(x);
|
||
}
|
||
};
|
||
return DistinctUntilChangedSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=distinctUntilChanged.js.map
|
||
},{"../Subscriber":20,"../util/bindCallback":142,"../util/errorObject":143,"../util/tryCatch":152}],61:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var noop_1 = require('../util/noop');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function _do(nextOrObserver, error, complete) {
|
||
var next;
|
||
if (nextOrObserver && typeof nextOrObserver === 'object') {
|
||
next = nextOrObserver.next;
|
||
error = nextOrObserver.error;
|
||
complete = nextOrObserver.complete;
|
||
}
|
||
else {
|
||
next = nextOrObserver;
|
||
}
|
||
return this.lift(new DoOperator(next || noop_1.noop, error || noop_1.noop, complete || noop_1.noop));
|
||
}
|
||
exports._do = _do;
|
||
var DoOperator = (function () {
|
||
function DoOperator(next, error, complete) {
|
||
this.next = next;
|
||
this.error = error;
|
||
this.complete = complete;
|
||
}
|
||
DoOperator.prototype.call = function (subscriber) {
|
||
return new DoSubscriber(subscriber, this.next, this.error, this.complete);
|
||
};
|
||
return DoOperator;
|
||
})();
|
||
var DoSubscriber = (function (_super) {
|
||
__extends(DoSubscriber, _super);
|
||
function DoSubscriber(destination, next, error, complete) {
|
||
_super.call(this, destination);
|
||
this.__next = next;
|
||
this.__error = error;
|
||
this.__complete = complete;
|
||
}
|
||
DoSubscriber.prototype._next = function (x) {
|
||
var result = tryCatch_1.tryCatch(this.__next)(x);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.destination.next(x);
|
||
}
|
||
};
|
||
DoSubscriber.prototype._error = function (e) {
|
||
var result = tryCatch_1.tryCatch(this.__error)(e);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.destination.error(e);
|
||
}
|
||
};
|
||
DoSubscriber.prototype._complete = function () {
|
||
var result = tryCatch_1.tryCatch(this.__complete)();
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
return DoSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=do.js.map
|
||
},{"../Subscriber":20,"../util/errorObject":143,"../util/noop":147,"../util/tryCatch":152}],62:[function(require,module,exports){
|
||
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 ScalarObservable_1 = require('../observables/ScalarObservable');
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
var ErrorObservable_1 = require('../observables/ErrorObservable');
|
||
var Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
function every(predicate, thisArg) {
|
||
var source = this;
|
||
var result;
|
||
if (source._isScalar) {
|
||
result = tryCatch_1.tryCatch(predicate)(source.value, 0, source);
|
||
if (result === errorObject_1.errorObject) {
|
||
return new ErrorObservable_1.ErrorObservable(errorObject_1.errorObject.e, source.scheduler);
|
||
}
|
||
else {
|
||
return new ScalarObservable_1.ScalarObservable(result, source.scheduler);
|
||
}
|
||
}
|
||
if (source instanceof ArrayObservable_1.ArrayObservable) {
|
||
var array = source.array;
|
||
var result_1 = tryCatch_1.tryCatch(function (array, predicate) { return array.every(predicate); })(array, predicate);
|
||
if (result_1 === errorObject_1.errorObject) {
|
||
return new ErrorObservable_1.ErrorObservable(errorObject_1.errorObject.e, source.scheduler);
|
||
}
|
||
else {
|
||
return new ScalarObservable_1.ScalarObservable(result_1, source.scheduler);
|
||
}
|
||
}
|
||
return source.lift(new EveryOperator(predicate, thisArg, source));
|
||
}
|
||
exports.every = every;
|
||
var EveryOperator = (function () {
|
||
function EveryOperator(predicate, thisArg, source) {
|
||
this.predicate = predicate;
|
||
this.thisArg = thisArg;
|
||
this.source = source;
|
||
}
|
||
EveryOperator.prototype.call = function (observer) {
|
||
return new EverySubscriber(observer, this.predicate, this.thisArg, this.source);
|
||
};
|
||
return EveryOperator;
|
||
})();
|
||
var EverySubscriber = (function (_super) {
|
||
__extends(EverySubscriber, _super);
|
||
function EverySubscriber(destination, predicate, thisArg, source) {
|
||
_super.call(this, destination);
|
||
this.thisArg = thisArg;
|
||
this.source = source;
|
||
this.predicate = undefined;
|
||
this.index = 0;
|
||
if (typeof predicate === 'function') {
|
||
this.predicate = bindCallback_1.bindCallback(predicate, thisArg, 3);
|
||
}
|
||
}
|
||
EverySubscriber.prototype.notifyComplete = function (everyValueMatch) {
|
||
this.destination.next(everyValueMatch);
|
||
this.destination.complete();
|
||
};
|
||
EverySubscriber.prototype._next = function (value) {
|
||
var predicate = this.predicate;
|
||
if (predicate === undefined) {
|
||
this.destination.error(new TypeError('predicate must be a function'));
|
||
}
|
||
var result = tryCatch_1.tryCatch(predicate)(value, this.index++, this.source);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(result.e);
|
||
}
|
||
else if (!result) {
|
||
this.notifyComplete(false);
|
||
}
|
||
};
|
||
EverySubscriber.prototype._complete = function () {
|
||
this.notifyComplete(true);
|
||
};
|
||
return EverySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=every.js.map
|
||
},{"../Subscriber":20,"../observables/ArrayObservable":22,"../observables/ErrorObservable":26,"../observables/ScalarObservable":36,"../util/bindCallback":142,"../util/errorObject":143,"../util/tryCatch":152}],63:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
var ExpandOperator = (function () {
|
||
function ExpandOperator(project, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
this.project = project;
|
||
this.concurrent = concurrent;
|
||
}
|
||
ExpandOperator.prototype.call = function (subscriber) {
|
||
return new ExpandSubscriber(subscriber, this.project, this.concurrent);
|
||
};
|
||
return ExpandOperator;
|
||
})();
|
||
exports.ExpandOperator = ExpandOperator;
|
||
var ExpandSubscriber = (function (_super) {
|
||
__extends(ExpandSubscriber, _super);
|
||
function ExpandSubscriber(destination, project, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
_super.call(this, destination);
|
||
this.project = project;
|
||
this.concurrent = concurrent;
|
||
this.index = 0;
|
||
this.active = 0;
|
||
this.hasCompleted = false;
|
||
if (concurrent < Number.POSITIVE_INFINITY) {
|
||
this.buffer = [];
|
||
}
|
||
}
|
||
ExpandSubscriber.prototype._next = function (value) {
|
||
var index = this.index++;
|
||
this.destination.next(value);
|
||
if (this.active < this.concurrent) {
|
||
var result = tryCatch_1.tryCatch(this.project)(value, index);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(result.e);
|
||
}
|
||
else {
|
||
if (result._isScalar) {
|
||
this._next(result.value);
|
||
}
|
||
else {
|
||
this.active++;
|
||
this.add(subscribeToResult_1.subscribeToResult(this, result, value, index));
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
this.buffer.push(value);
|
||
}
|
||
};
|
||
ExpandSubscriber.prototype._complete = function () {
|
||
this.hasCompleted = true;
|
||
if (this.hasCompleted && this.active === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
ExpandSubscriber.prototype.notifyComplete = function (innerSub) {
|
||
var buffer = this.buffer;
|
||
this.remove(innerSub);
|
||
this.active--;
|
||
if (buffer && buffer.length > 0) {
|
||
this._next(buffer.shift());
|
||
}
|
||
if (this.hasCompleted && this.active === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
this._next(innerValue);
|
||
};
|
||
return ExpandSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
exports.ExpandSubscriber = ExpandSubscriber;
|
||
//# sourceMappingURL=expand-support.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],64:[function(require,module,exports){
|
||
var expand_support_1 = require('./expand-support');
|
||
function expand(project, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
return this.lift(new expand_support_1.ExpandOperator(project, concurrent));
|
||
}
|
||
exports.expand = expand;
|
||
//# sourceMappingURL=expand.js.map
|
||
},{"./expand-support":63}],65:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
/**
|
||
* Similar to the well-known `Array.prototype.filter` method, this operator filters values down to a set
|
||
* allowed by a `select` function
|
||
*
|
||
* @param {Function} select a function that is used to select the resulting values
|
||
* if it returns `true`, the value is emitted, if `false` the value is not passed to the resulting observable
|
||
* @param {any} [thisArg] an optional argument to determine the value of `this` in the `select` function
|
||
* @returns {Observable} an observable of values allowed by the select function
|
||
*/
|
||
function filter(select, thisArg) {
|
||
return this.lift(new FilterOperator(select, thisArg));
|
||
}
|
||
exports.filter = filter;
|
||
var FilterOperator = (function () {
|
||
function FilterOperator(select, thisArg) {
|
||
this.select = bindCallback_1.bindCallback(select, thisArg, 2);
|
||
}
|
||
FilterOperator.prototype.call = function (subscriber) {
|
||
return new FilterSubscriber(subscriber, this.select);
|
||
};
|
||
return FilterOperator;
|
||
})();
|
||
var FilterSubscriber = (function (_super) {
|
||
__extends(FilterSubscriber, _super);
|
||
function FilterSubscriber(destination, select) {
|
||
_super.call(this, destination);
|
||
this.count = 0;
|
||
this.select = select;
|
||
}
|
||
FilterSubscriber.prototype._next = function (x) {
|
||
var result = tryCatch_1.tryCatch(this.select)(x, this.count++);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else if (Boolean(result)) {
|
||
this.destination.next(x);
|
||
}
|
||
};
|
||
return FilterSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=filter.js.map
|
||
},{"../Subscriber":20,"../util/bindCallback":142,"../util/errorObject":143,"../util/tryCatch":152}],66:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subscription_1 = require('../Subscription');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
function _finally(finallySelector, thisArg) {
|
||
return this.lift(new FinallyOperator(thisArg ?
|
||
bindCallback_1.bindCallback(finallySelector, thisArg, 2) :
|
||
finallySelector));
|
||
}
|
||
exports._finally = _finally;
|
||
var FinallyOperator = (function () {
|
||
function FinallyOperator(finallySelector) {
|
||
this.finallySelector = finallySelector;
|
||
}
|
||
FinallyOperator.prototype.call = function (subscriber) {
|
||
return new FinallySubscriber(subscriber, this.finallySelector);
|
||
};
|
||
return FinallyOperator;
|
||
})();
|
||
var FinallySubscriber = (function (_super) {
|
||
__extends(FinallySubscriber, _super);
|
||
function FinallySubscriber(destination, finallySelector) {
|
||
_super.call(this, destination);
|
||
this.add(new Subscription_1.Subscription(finallySelector));
|
||
}
|
||
return FinallySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=finally.js.map
|
||
},{"../Subscriber":20,"../Subscription":21,"../util/bindCallback":142}],67:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var EmptyError_1 = require('../util/EmptyError');
|
||
function first(predicate, resultSelector, defaultValue) {
|
||
return this.lift(new FirstOperator(predicate, resultSelector, defaultValue, this));
|
||
}
|
||
exports.first = first;
|
||
var FirstOperator = (function () {
|
||
function FirstOperator(predicate, resultSelector, defaultValue, source) {
|
||
this.predicate = predicate;
|
||
this.resultSelector = resultSelector;
|
||
this.defaultValue = defaultValue;
|
||
this.source = source;
|
||
}
|
||
FirstOperator.prototype.call = function (observer) {
|
||
return new FirstSubscriber(observer, this.predicate, this.resultSelector, this.defaultValue, this.source);
|
||
};
|
||
return FirstOperator;
|
||
})();
|
||
var FirstSubscriber = (function (_super) {
|
||
__extends(FirstSubscriber, _super);
|
||
function FirstSubscriber(destination, predicate, resultSelector, defaultValue, source) {
|
||
_super.call(this, destination);
|
||
this.predicate = predicate;
|
||
this.resultSelector = resultSelector;
|
||
this.defaultValue = defaultValue;
|
||
this.source = source;
|
||
this.index = 0;
|
||
this.hasCompleted = false;
|
||
}
|
||
FirstSubscriber.prototype._next = function (value) {
|
||
var _a = this, destination = _a.destination, predicate = _a.predicate, resultSelector = _a.resultSelector;
|
||
var index = this.index++;
|
||
var passed = true;
|
||
if (predicate) {
|
||
passed = tryCatch_1.tryCatch(predicate)(value, index, this.source);
|
||
if (passed === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
return;
|
||
}
|
||
}
|
||
if (passed) {
|
||
if (resultSelector) {
|
||
var result = tryCatch_1.tryCatch(resultSelector)(value, index);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
return;
|
||
}
|
||
destination.next(result);
|
||
}
|
||
else {
|
||
destination.next(value);
|
||
}
|
||
destination.complete();
|
||
this.hasCompleted = true;
|
||
}
|
||
};
|
||
FirstSubscriber.prototype._complete = function () {
|
||
var destination = this.destination;
|
||
if (!this.hasCompleted && typeof this.defaultValue !== 'undefined') {
|
||
destination.next(this.defaultValue);
|
||
destination.complete();
|
||
}
|
||
else if (!this.hasCompleted) {
|
||
destination.error(new EmptyError_1.EmptyError);
|
||
}
|
||
};
|
||
return FirstSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=first.js.map
|
||
},{"../Subscriber":20,"../util/EmptyError":135,"../util/errorObject":143,"../util/tryCatch":152}],68:[function(require,module,exports){
|
||
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 Subscription_1 = require('../Subscription');
|
||
var Observable_1 = require('../Observable');
|
||
var RefCountSubscription = (function (_super) {
|
||
__extends(RefCountSubscription, _super);
|
||
function RefCountSubscription() {
|
||
_super.call(this);
|
||
this.attemptedToUnsubscribePrimary = false;
|
||
this.count = 0;
|
||
}
|
||
RefCountSubscription.prototype.setPrimary = function (subscription) {
|
||
this.primary = subscription;
|
||
};
|
||
RefCountSubscription.prototype.unsubscribe = function () {
|
||
if (!this.isUnsubscribed && !this.attemptedToUnsubscribePrimary) {
|
||
this.attemptedToUnsubscribePrimary = true;
|
||
if (this.count === 0) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
this.primary.unsubscribe();
|
||
}
|
||
}
|
||
};
|
||
return RefCountSubscription;
|
||
})(Subscription_1.Subscription);
|
||
exports.RefCountSubscription = RefCountSubscription;
|
||
var GroupedObservable = (function (_super) {
|
||
__extends(GroupedObservable, _super);
|
||
function GroupedObservable(key, groupSubject, refCountSubscription) {
|
||
_super.call(this);
|
||
this.key = key;
|
||
this.groupSubject = groupSubject;
|
||
this.refCountSubscription = refCountSubscription;
|
||
}
|
||
GroupedObservable.prototype._subscribe = function (subscriber) {
|
||
var subscription = new Subscription_1.Subscription();
|
||
if (this.refCountSubscription && !this.refCountSubscription.isUnsubscribed) {
|
||
subscription.add(new InnerRefCountSubscription(this.refCountSubscription));
|
||
}
|
||
subscription.add(this.groupSubject.subscribe(subscriber));
|
||
return subscription;
|
||
};
|
||
return GroupedObservable;
|
||
})(Observable_1.Observable);
|
||
exports.GroupedObservable = GroupedObservable;
|
||
var InnerRefCountSubscription = (function (_super) {
|
||
__extends(InnerRefCountSubscription, _super);
|
||
function InnerRefCountSubscription(parent) {
|
||
_super.call(this);
|
||
this.parent = parent;
|
||
parent.count++;
|
||
}
|
||
InnerRefCountSubscription.prototype.unsubscribe = function () {
|
||
if (!this.parent.isUnsubscribed && !this.isUnsubscribed) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
this.parent.count--;
|
||
if (this.parent.count === 0 && this.parent.attemptedToUnsubscribePrimary) {
|
||
this.parent.unsubscribe();
|
||
this.parent.primary.unsubscribe();
|
||
}
|
||
}
|
||
};
|
||
return InnerRefCountSubscription;
|
||
})(Subscription_1.Subscription);
|
||
exports.InnerRefCountSubscription = InnerRefCountSubscription;
|
||
//# sourceMappingURL=groupBy-support.js.map
|
||
},{"../Observable":16,"../Subscription":21}],69:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Observable_1 = require('../Observable');
|
||
var Subject_1 = require('../Subject');
|
||
var Map_1 = require('../util/Map');
|
||
var FastMap_1 = require('../util/FastMap');
|
||
var groupBy_support_1 = require('./groupBy-support');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function groupBy(keySelector, elementSelector, durationSelector) {
|
||
return new GroupByObservable(this, keySelector, elementSelector, durationSelector);
|
||
}
|
||
exports.groupBy = groupBy;
|
||
var GroupByObservable = (function (_super) {
|
||
__extends(GroupByObservable, _super);
|
||
function GroupByObservable(source, keySelector, elementSelector, durationSelector) {
|
||
_super.call(this);
|
||
this.source = source;
|
||
this.keySelector = keySelector;
|
||
this.elementSelector = elementSelector;
|
||
this.durationSelector = durationSelector;
|
||
}
|
||
GroupByObservable.prototype._subscribe = function (subscriber) {
|
||
var refCountSubscription = new groupBy_support_1.RefCountSubscription();
|
||
var groupBySubscriber = new GroupBySubscriber(subscriber, refCountSubscription, this.keySelector, this.elementSelector, this.durationSelector);
|
||
refCountSubscription.setPrimary(this.source.subscribe(groupBySubscriber));
|
||
return refCountSubscription;
|
||
};
|
||
return GroupByObservable;
|
||
})(Observable_1.Observable);
|
||
exports.GroupByObservable = GroupByObservable;
|
||
var GroupBySubscriber = (function (_super) {
|
||
__extends(GroupBySubscriber, _super);
|
||
function GroupBySubscriber(destination, refCountSubscription, keySelector, elementSelector, durationSelector) {
|
||
_super.call(this);
|
||
this.refCountSubscription = refCountSubscription;
|
||
this.keySelector = keySelector;
|
||
this.elementSelector = elementSelector;
|
||
this.durationSelector = durationSelector;
|
||
this.groups = null;
|
||
this.destination = destination;
|
||
this.add(destination);
|
||
}
|
||
GroupBySubscriber.prototype._next = function (x) {
|
||
var key = tryCatch_1.tryCatch(this.keySelector)(x);
|
||
if (key === errorObject_1.errorObject) {
|
||
this.error(key.e);
|
||
}
|
||
else {
|
||
var groups = this.groups;
|
||
var elementSelector = this.elementSelector;
|
||
var durationSelector = this.durationSelector;
|
||
if (!groups) {
|
||
groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map();
|
||
}
|
||
var group = groups.get(key);
|
||
if (!group) {
|
||
groups.set(key, group = new Subject_1.Subject());
|
||
var groupedObservable = new groupBy_support_1.GroupedObservable(key, group, this.refCountSubscription);
|
||
if (durationSelector) {
|
||
var duration = tryCatch_1.tryCatch(durationSelector)(new groupBy_support_1.GroupedObservable(key, group));
|
||
if (duration === errorObject_1.errorObject) {
|
||
this.error(duration.e);
|
||
}
|
||
else {
|
||
this.add(duration._subscribe(new GroupDurationSubscriber(key, group, this)));
|
||
}
|
||
}
|
||
this.destination.next(groupedObservable);
|
||
}
|
||
if (elementSelector) {
|
||
var value = tryCatch_1.tryCatch(elementSelector)(x);
|
||
if (value === errorObject_1.errorObject) {
|
||
this.error(value.e);
|
||
}
|
||
else {
|
||
group.next(value);
|
||
}
|
||
}
|
||
else {
|
||
group.next(x);
|
||
}
|
||
}
|
||
};
|
||
GroupBySubscriber.prototype._error = function (err) {
|
||
var _this = this;
|
||
var groups = this.groups;
|
||
if (groups) {
|
||
groups.forEach(function (group, key) {
|
||
group.error(err);
|
||
_this.removeGroup(key);
|
||
});
|
||
}
|
||
this.destination.error(err);
|
||
};
|
||
GroupBySubscriber.prototype._complete = function () {
|
||
var _this = this;
|
||
var groups = this.groups;
|
||
if (groups) {
|
||
groups.forEach(function (group, key) {
|
||
group.complete();
|
||
_this.removeGroup(group);
|
||
});
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
GroupBySubscriber.prototype.removeGroup = function (key) {
|
||
this.groups.delete(key);
|
||
};
|
||
return GroupBySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var GroupDurationSubscriber = (function (_super) {
|
||
__extends(GroupDurationSubscriber, _super);
|
||
function GroupDurationSubscriber(key, group, parent) {
|
||
_super.call(this, null);
|
||
this.key = key;
|
||
this.group = group;
|
||
this.parent = parent;
|
||
}
|
||
GroupDurationSubscriber.prototype._next = function (value) {
|
||
this.group.complete();
|
||
this.parent.removeGroup(this.key);
|
||
};
|
||
GroupDurationSubscriber.prototype._error = function (err) {
|
||
this.group.error(err);
|
||
this.parent.removeGroup(this.key);
|
||
};
|
||
GroupDurationSubscriber.prototype._complete = function () {
|
||
this.group.complete();
|
||
this.parent.removeGroup(this.key);
|
||
};
|
||
return GroupDurationSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=groupBy.js.map
|
||
},{"../Observable":16,"../Subject":19,"../Subscriber":20,"../util/FastMap":136,"../util/Map":138,"../util/errorObject":143,"../util/tryCatch":152,"./groupBy-support":68}],70:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var noop_1 = require('../util/noop');
|
||
function ignoreElements() {
|
||
return this.lift(new IgnoreElementsOperator());
|
||
}
|
||
exports.ignoreElements = ignoreElements;
|
||
;
|
||
var IgnoreElementsOperator = (function () {
|
||
function IgnoreElementsOperator() {
|
||
}
|
||
IgnoreElementsOperator.prototype.call = function (subscriber) {
|
||
return new IgnoreElementsSubscriber(subscriber);
|
||
};
|
||
return IgnoreElementsOperator;
|
||
})();
|
||
var IgnoreElementsSubscriber = (function (_super) {
|
||
__extends(IgnoreElementsSubscriber, _super);
|
||
function IgnoreElementsSubscriber() {
|
||
_super.apply(this, arguments);
|
||
}
|
||
IgnoreElementsSubscriber.prototype._next = function (unused) {
|
||
noop_1.noop();
|
||
};
|
||
return IgnoreElementsSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=ignoreElements.js.map
|
||
},{"../Subscriber":20,"../util/noop":147}],71:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var EmptyError_1 = require('../util/EmptyError');
|
||
function last(predicate, resultSelector, defaultValue) {
|
||
return this.lift(new LastOperator(predicate, resultSelector, defaultValue, this));
|
||
}
|
||
exports.last = last;
|
||
var LastOperator = (function () {
|
||
function LastOperator(predicate, resultSelector, defaultValue, source) {
|
||
this.predicate = predicate;
|
||
this.resultSelector = resultSelector;
|
||
this.defaultValue = defaultValue;
|
||
this.source = source;
|
||
}
|
||
LastOperator.prototype.call = function (observer) {
|
||
return new LastSubscriber(observer, this.predicate, this.resultSelector, this.defaultValue, this.source);
|
||
};
|
||
return LastOperator;
|
||
})();
|
||
var LastSubscriber = (function (_super) {
|
||
__extends(LastSubscriber, _super);
|
||
function LastSubscriber(destination, predicate, resultSelector, defaultValue, source) {
|
||
_super.call(this, destination);
|
||
this.predicate = predicate;
|
||
this.resultSelector = resultSelector;
|
||
this.defaultValue = defaultValue;
|
||
this.source = source;
|
||
this.hasValue = false;
|
||
this.index = 0;
|
||
if (typeof defaultValue !== 'undefined') {
|
||
this.lastValue = defaultValue;
|
||
this.hasValue = true;
|
||
}
|
||
}
|
||
LastSubscriber.prototype._next = function (value) {
|
||
var _a = this, predicate = _a.predicate, resultSelector = _a.resultSelector, destination = _a.destination;
|
||
var index = this.index++;
|
||
if (predicate) {
|
||
var found = tryCatch_1.tryCatch(predicate)(value, index, this.source);
|
||
if (found === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
return;
|
||
}
|
||
if (found) {
|
||
if (resultSelector) {
|
||
var result = tryCatch_1.tryCatch(resultSelector)(value, index);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
return;
|
||
}
|
||
this.lastValue = result;
|
||
}
|
||
else {
|
||
this.lastValue = value;
|
||
}
|
||
this.hasValue = true;
|
||
}
|
||
}
|
||
else {
|
||
this.lastValue = value;
|
||
this.hasValue = true;
|
||
}
|
||
};
|
||
LastSubscriber.prototype._complete = function () {
|
||
var destination = this.destination;
|
||
if (this.hasValue) {
|
||
destination.next(this.lastValue);
|
||
destination.complete();
|
||
}
|
||
else {
|
||
destination.error(new EmptyError_1.EmptyError);
|
||
}
|
||
};
|
||
return LastSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=last.js.map
|
||
},{"../Subscriber":20,"../util/EmptyError":135,"../util/errorObject":143,"../util/tryCatch":152}],72:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
/**
|
||
* Similar to the well known `Array.prototype.map` function, this operator
|
||
* applies a projection to each value and emits that projection in the returned observable
|
||
*
|
||
* @param {Function} project the function to create projection
|
||
* @param {any} [thisArg] an optional argument to define what `this` is in the project function
|
||
* @returns {Observable} a observable of projected values
|
||
*/
|
||
function map(project, thisArg) {
|
||
return this.lift(new MapOperator(project, thisArg));
|
||
}
|
||
exports.map = map;
|
||
var MapOperator = (function () {
|
||
function MapOperator(project, thisArg) {
|
||
this.project = bindCallback_1.bindCallback(project, thisArg, 2);
|
||
}
|
||
MapOperator.prototype.call = function (subscriber) {
|
||
return new MapSubscriber(subscriber, this.project);
|
||
};
|
||
return MapOperator;
|
||
})();
|
||
var MapSubscriber = (function (_super) {
|
||
__extends(MapSubscriber, _super);
|
||
function MapSubscriber(destination, project) {
|
||
_super.call(this, destination);
|
||
this.count = 0;
|
||
this.project = project;
|
||
}
|
||
MapSubscriber.prototype._next = function (x) {
|
||
var result = tryCatch_1.tryCatch(this.project)(x, this.count++);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.destination.next(result);
|
||
}
|
||
};
|
||
return MapSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=map.js.map
|
||
},{"../Subscriber":20,"../util/bindCallback":142,"../util/errorObject":143,"../util/tryCatch":152}],73:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
/**
|
||
* Maps every value to the same value every time.
|
||
* @param {any} value the value to map each incoming value to
|
||
* @returns {Observable} an observable of the passed value that emits everytime the source does
|
||
*/
|
||
function mapTo(value) {
|
||
return this.lift(new MapToOperator(value));
|
||
}
|
||
exports.mapTo = mapTo;
|
||
var MapToOperator = (function () {
|
||
function MapToOperator(value) {
|
||
this.value = value;
|
||
}
|
||
MapToOperator.prototype.call = function (subscriber) {
|
||
return new MapToSubscriber(subscriber, this.value);
|
||
};
|
||
return MapToOperator;
|
||
})();
|
||
var MapToSubscriber = (function (_super) {
|
||
__extends(MapToSubscriber, _super);
|
||
function MapToSubscriber(destination, value) {
|
||
_super.call(this, destination);
|
||
this.value = value;
|
||
}
|
||
MapToSubscriber.prototype._next = function (x) {
|
||
this.destination.next(this.value);
|
||
};
|
||
return MapToSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=mapTo.js.map
|
||
},{"../Subscriber":20}],74:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Notification_1 = require('../Notification');
|
||
function materialize() {
|
||
return this.lift(new MaterializeOperator());
|
||
}
|
||
exports.materialize = materialize;
|
||
var MaterializeOperator = (function () {
|
||
function MaterializeOperator() {
|
||
}
|
||
MaterializeOperator.prototype.call = function (subscriber) {
|
||
return new MaterializeSubscriber(subscriber);
|
||
};
|
||
return MaterializeOperator;
|
||
})();
|
||
var MaterializeSubscriber = (function (_super) {
|
||
__extends(MaterializeSubscriber, _super);
|
||
function MaterializeSubscriber(destination) {
|
||
_super.call(this, destination);
|
||
}
|
||
MaterializeSubscriber.prototype._next = function (value) {
|
||
this.destination.next(Notification_1.Notification.createNext(value));
|
||
};
|
||
MaterializeSubscriber.prototype._error = function (err) {
|
||
var destination = this.destination;
|
||
destination.next(Notification_1.Notification.createError(err));
|
||
destination.complete();
|
||
};
|
||
MaterializeSubscriber.prototype._complete = function () {
|
||
var destination = this.destination;
|
||
destination.next(Notification_1.Notification.createComplete());
|
||
destination.complete();
|
||
};
|
||
return MaterializeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=materialize.js.map
|
||
},{"../Notification":15,"../Subscriber":20}],75:[function(require,module,exports){
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
var mergeAll_support_1 = require('./mergeAll-support');
|
||
var immediate_1 = require('../schedulers/immediate');
|
||
function merge() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
var concurrent = Number.POSITIVE_INFINITY;
|
||
var scheduler = immediate_1.immediate;
|
||
var last = observables[observables.length - 1];
|
||
if (typeof last.schedule === 'function') {
|
||
scheduler = observables.pop();
|
||
if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
|
||
concurrent = observables.pop();
|
||
}
|
||
}
|
||
else if (typeof last === 'number') {
|
||
concurrent = observables.pop();
|
||
}
|
||
if (observables.length === 1) {
|
||
return observables[0];
|
||
}
|
||
return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new mergeAll_support_1.MergeAllOperator(concurrent));
|
||
}
|
||
exports.merge = merge;
|
||
//# sourceMappingURL=merge-static.js.map
|
||
},{"../observables/ArrayObservable":22,"../schedulers/immediate":129,"./mergeAll-support":77}],76:[function(require,module,exports){
|
||
var merge_static_1 = require('./merge-static');
|
||
function merge() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
observables.unshift(this);
|
||
return merge_static_1.merge.apply(this, observables);
|
||
}
|
||
exports.merge = merge;
|
||
//# sourceMappingURL=merge.js.map
|
||
},{"./merge-static":75}],77:[function(require,module,exports){
|
||
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 OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
var MergeAllOperator = (function () {
|
||
function MergeAllOperator(concurrent) {
|
||
this.concurrent = concurrent;
|
||
}
|
||
MergeAllOperator.prototype.call = function (observer) {
|
||
return new MergeAllSubscriber(observer, this.concurrent);
|
||
};
|
||
return MergeAllOperator;
|
||
})();
|
||
exports.MergeAllOperator = MergeAllOperator;
|
||
var MergeAllSubscriber = (function (_super) {
|
||
__extends(MergeAllSubscriber, _super);
|
||
function MergeAllSubscriber(destination, concurrent) {
|
||
_super.call(this, destination);
|
||
this.concurrent = concurrent;
|
||
this.hasCompleted = false;
|
||
this.buffer = [];
|
||
this.active = 0;
|
||
}
|
||
MergeAllSubscriber.prototype._next = function (observable) {
|
||
if (this.active < this.concurrent) {
|
||
if (observable._isScalar) {
|
||
this.destination.next(observable.value);
|
||
}
|
||
else {
|
||
this.active++;
|
||
this.add(subscribeToResult_1.subscribeToResult(this, observable));
|
||
}
|
||
}
|
||
else {
|
||
this.buffer.push(observable);
|
||
}
|
||
};
|
||
MergeAllSubscriber.prototype._complete = function () {
|
||
this.hasCompleted = true;
|
||
if (this.active === 0 && this.buffer.length === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
MergeAllSubscriber.prototype.notifyComplete = function (innerSub) {
|
||
var buffer = this.buffer;
|
||
this.remove(innerSub);
|
||
this.active--;
|
||
if (buffer.length > 0) {
|
||
this._next(buffer.shift());
|
||
}
|
||
else if (this.active === 0 && this.hasCompleted) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
return MergeAllSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
exports.MergeAllSubscriber = MergeAllSubscriber;
|
||
//# sourceMappingURL=mergeAll-support.js.map
|
||
},{"../OuterSubscriber":17,"../util/subscribeToResult":150}],78:[function(require,module,exports){
|
||
var mergeAll_support_1 = require('./mergeAll-support');
|
||
function mergeAll(concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
return this.lift(new mergeAll_support_1.MergeAllOperator(concurrent));
|
||
}
|
||
exports.mergeAll = mergeAll;
|
||
//# sourceMappingURL=mergeAll.js.map
|
||
},{"./mergeAll-support":77}],79:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var MergeMapOperator = (function () {
|
||
function MergeMapOperator(project, resultSelector, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
this.project = project;
|
||
this.resultSelector = resultSelector;
|
||
this.concurrent = concurrent;
|
||
}
|
||
MergeMapOperator.prototype.call = function (observer) {
|
||
return new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent);
|
||
};
|
||
return MergeMapOperator;
|
||
})();
|
||
exports.MergeMapOperator = MergeMapOperator;
|
||
var MergeMapSubscriber = (function (_super) {
|
||
__extends(MergeMapSubscriber, _super);
|
||
function MergeMapSubscriber(destination, project, resultSelector, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
_super.call(this, destination);
|
||
this.project = project;
|
||
this.resultSelector = resultSelector;
|
||
this.concurrent = concurrent;
|
||
this.hasCompleted = false;
|
||
this.buffer = [];
|
||
this.active = 0;
|
||
this.index = 0;
|
||
}
|
||
MergeMapSubscriber.prototype._next = function (value) {
|
||
if (this.active < this.concurrent) {
|
||
var index = this.index++;
|
||
var ish = tryCatch_1.tryCatch(this.project)(value, index);
|
||
var destination = this.destination;
|
||
if (ish === errorObject_1.errorObject) {
|
||
destination.error(ish.e);
|
||
}
|
||
else {
|
||
this.active++;
|
||
this._innerSub(ish, value, index);
|
||
}
|
||
}
|
||
else {
|
||
this.buffer.push(value);
|
||
}
|
||
};
|
||
MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
|
||
this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index));
|
||
};
|
||
MergeMapSubscriber.prototype._complete = function () {
|
||
this.hasCompleted = true;
|
||
if (this.active === 0 && this.buffer.length === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
var _a = this, destination = _a.destination, resultSelector = _a.resultSelector;
|
||
if (resultSelector) {
|
||
var result = tryCatch_1.tryCatch(resultSelector)(outerValue, innerValue, outerIndex, innerIndex);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(innerValue);
|
||
}
|
||
};
|
||
MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
|
||
var buffer = this.buffer;
|
||
this.remove(innerSub);
|
||
this.active--;
|
||
if (buffer.length > 0) {
|
||
this._next(buffer.shift());
|
||
}
|
||
else if (this.active === 0 && this.hasCompleted) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
return MergeMapSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
exports.MergeMapSubscriber = MergeMapSubscriber;
|
||
//# sourceMappingURL=mergeMap-support.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],80:[function(require,module,exports){
|
||
var mergeMap_support_1 = require('./mergeMap-support');
|
||
function mergeMap(project, resultSelector, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
return this.lift(new mergeMap_support_1.MergeMapOperator(project, resultSelector, concurrent));
|
||
}
|
||
exports.mergeMap = mergeMap;
|
||
//# sourceMappingURL=mergeMap.js.map
|
||
},{"./mergeMap-support":79}],81:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
var MergeMapToOperator = (function () {
|
||
function MergeMapToOperator(ish, resultSelector, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
this.ish = ish;
|
||
this.resultSelector = resultSelector;
|
||
this.concurrent = concurrent;
|
||
}
|
||
MergeMapToOperator.prototype.call = function (observer) {
|
||
return new MergeMapToSubscriber(observer, this.ish, this.resultSelector, this.concurrent);
|
||
};
|
||
return MergeMapToOperator;
|
||
})();
|
||
exports.MergeMapToOperator = MergeMapToOperator;
|
||
var MergeMapToSubscriber = (function (_super) {
|
||
__extends(MergeMapToSubscriber, _super);
|
||
function MergeMapToSubscriber(destination, ish, resultSelector, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
_super.call(this, destination);
|
||
this.ish = ish;
|
||
this.resultSelector = resultSelector;
|
||
this.concurrent = concurrent;
|
||
this.hasCompleted = false;
|
||
this.buffer = [];
|
||
this.active = 0;
|
||
this.index = 0;
|
||
}
|
||
MergeMapToSubscriber.prototype._next = function (value) {
|
||
if (this.active < this.concurrent) {
|
||
var resultSelector = this.resultSelector;
|
||
var index = this.index++;
|
||
var ish = this.ish;
|
||
var destination = this.destination;
|
||
if (ish === errorObject_1.errorObject) {
|
||
destination.error(ish.e);
|
||
}
|
||
else {
|
||
this.active++;
|
||
this._innerSub(ish, destination, resultSelector, value, index);
|
||
}
|
||
}
|
||
else {
|
||
this.buffer.push(value);
|
||
}
|
||
};
|
||
MergeMapToSubscriber.prototype._innerSub = function (ish, destination, resultSelector, value, index) {
|
||
this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index));
|
||
};
|
||
MergeMapToSubscriber.prototype._complete = function () {
|
||
this.hasCompleted = true;
|
||
if (this.active === 0 && this.buffer.length === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
MergeMapToSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
var _a = this, resultSelector = _a.resultSelector, destination = _a.destination;
|
||
if (resultSelector) {
|
||
var result = tryCatch_1.tryCatch(resultSelector)(outerValue, innerValue, outerIndex, innerIndex);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(innerValue);
|
||
}
|
||
};
|
||
MergeMapToSubscriber.prototype.notifyError = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
MergeMapToSubscriber.prototype.notifyComplete = function (innerSub) {
|
||
var buffer = this.buffer;
|
||
this.remove(innerSub);
|
||
this.active--;
|
||
if (buffer.length > 0) {
|
||
this._next(buffer.shift());
|
||
}
|
||
else if (this.active === 0 && this.hasCompleted) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
return MergeMapToSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
exports.MergeMapToSubscriber = MergeMapToSubscriber;
|
||
//# sourceMappingURL=mergeMapTo-support.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],82:[function(require,module,exports){
|
||
var mergeMapTo_support_1 = require('./mergeMapTo-support');
|
||
function mergeMapTo(observable, resultSelector, concurrent) {
|
||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||
return this.lift(new mergeMapTo_support_1.MergeMapToOperator(observable, resultSelector, concurrent));
|
||
}
|
||
exports.mergeMapTo = mergeMapTo;
|
||
//# sourceMappingURL=mergeMapTo.js.map
|
||
},{"./mergeMapTo-support":81}],83:[function(require,module,exports){
|
||
var ConnectableObservable_1 = require('../observables/ConnectableObservable');
|
||
function multicast(subjectOrSubjectFactory) {
|
||
var subjectFactory;
|
||
if (typeof subjectOrSubjectFactory === 'function') {
|
||
subjectFactory = subjectOrSubjectFactory;
|
||
}
|
||
else {
|
||
subjectFactory = function subjectFactory() {
|
||
return subjectOrSubjectFactory;
|
||
};
|
||
}
|
||
return new ConnectableObservable_1.ConnectableObservable(this, subjectFactory);
|
||
}
|
||
exports.multicast = multicast;
|
||
//# sourceMappingURL=multicast.js.map
|
||
},{"../observables/ConnectableObservable":23}],84:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Notification_1 = require('../Notification');
|
||
var ObserveOnOperator = (function () {
|
||
function ObserveOnOperator(scheduler, delay) {
|
||
if (delay === void 0) { delay = 0; }
|
||
this.scheduler = scheduler;
|
||
this.delay = delay;
|
||
}
|
||
ObserveOnOperator.prototype.call = function (subscriber) {
|
||
return new ObserveOnSubscriber(subscriber, this.scheduler, this.delay);
|
||
};
|
||
return ObserveOnOperator;
|
||
})();
|
||
exports.ObserveOnOperator = ObserveOnOperator;
|
||
var ObserveOnSubscriber = (function (_super) {
|
||
__extends(ObserveOnSubscriber, _super);
|
||
function ObserveOnSubscriber(destination, scheduler, delay) {
|
||
if (delay === void 0) { delay = 0; }
|
||
_super.call(this, destination);
|
||
this.scheduler = scheduler;
|
||
this.delay = delay;
|
||
}
|
||
ObserveOnSubscriber.dispatch = function (_a) {
|
||
var notification = _a.notification, destination = _a.destination;
|
||
notification.observe(destination);
|
||
};
|
||
ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
|
||
this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
|
||
};
|
||
ObserveOnSubscriber.prototype._next = function (value) {
|
||
this.scheduleMessage(Notification_1.Notification.createNext(value));
|
||
};
|
||
ObserveOnSubscriber.prototype._error = function (err) {
|
||
this.scheduleMessage(Notification_1.Notification.createError(err));
|
||
};
|
||
ObserveOnSubscriber.prototype._complete = function () {
|
||
this.scheduleMessage(Notification_1.Notification.createComplete());
|
||
};
|
||
return ObserveOnSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
exports.ObserveOnSubscriber = ObserveOnSubscriber;
|
||
var ObserveOnMessage = (function () {
|
||
function ObserveOnMessage(notification, destination) {
|
||
this.notification = notification;
|
||
this.destination = destination;
|
||
}
|
||
return ObserveOnMessage;
|
||
})();
|
||
//# sourceMappingURL=observeOn-support.js.map
|
||
},{"../Notification":15,"../Subscriber":20}],85:[function(require,module,exports){
|
||
var observeOn_support_1 = require('./observeOn-support');
|
||
function observeOn(scheduler, delay) {
|
||
if (delay === void 0) { delay = 0; }
|
||
return this.lift(new observeOn_support_1.ObserveOnOperator(scheduler, delay));
|
||
}
|
||
exports.observeOn = observeOn;
|
||
//# sourceMappingURL=observeOn.js.map
|
||
},{"./observeOn-support":84}],86:[function(require,module,exports){
|
||
var not_1 = require('../util/not');
|
||
var filter_1 = require('./filter');
|
||
function partition(predicate, thisArg) {
|
||
return [
|
||
filter_1.filter.call(this, predicate),
|
||
filter_1.filter.call(this, not_1.not(predicate, thisArg))
|
||
];
|
||
}
|
||
exports.partition = partition;
|
||
//# sourceMappingURL=partition.js.map
|
||
},{"../util/not":148,"./filter":65}],87:[function(require,module,exports){
|
||
var Subject_1 = require('../Subject');
|
||
var multicast_1 = require('./multicast');
|
||
function publish() {
|
||
return multicast_1.multicast.call(this, new Subject_1.Subject());
|
||
}
|
||
exports.publish = publish;
|
||
//# sourceMappingURL=publish.js.map
|
||
},{"../Subject":19,"./multicast":83}],88:[function(require,module,exports){
|
||
var BehaviorSubject_1 = require('../subjects/BehaviorSubject');
|
||
var multicast_1 = require('./multicast');
|
||
function publishBehavior(value) {
|
||
return multicast_1.multicast.call(this, new BehaviorSubject_1.BehaviorSubject(value));
|
||
}
|
||
exports.publishBehavior = publishBehavior;
|
||
//# sourceMappingURL=publishBehavior.js.map
|
||
},{"../subjects/BehaviorSubject":131,"./multicast":83}],89:[function(require,module,exports){
|
||
var ReplaySubject_1 = require('../subjects/ReplaySubject');
|
||
var multicast_1 = require('./multicast');
|
||
function publishReplay(bufferSize, windowTime, scheduler) {
|
||
if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; }
|
||
if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; }
|
||
return multicast_1.multicast.call(this, new ReplaySubject_1.ReplaySubject(bufferSize, windowTime, scheduler));
|
||
}
|
||
exports.publishReplay = publishReplay;
|
||
//# sourceMappingURL=publishReplay.js.map
|
||
},{"../subjects/ReplaySubject":132,"./multicast":83}],90:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var ReduceOperator = (function () {
|
||
function ReduceOperator(project, seed) {
|
||
this.project = project;
|
||
this.seed = seed;
|
||
}
|
||
ReduceOperator.prototype.call = function (subscriber) {
|
||
return new ReduceSubscriber(subscriber, this.project, this.seed);
|
||
};
|
||
return ReduceOperator;
|
||
})();
|
||
exports.ReduceOperator = ReduceOperator;
|
||
var ReduceSubscriber = (function (_super) {
|
||
__extends(ReduceSubscriber, _super);
|
||
function ReduceSubscriber(destination, project, seed) {
|
||
_super.call(this, destination);
|
||
this.hasValue = false;
|
||
this.acc = seed;
|
||
this.project = project;
|
||
this.hasSeed = typeof seed !== 'undefined';
|
||
}
|
||
ReduceSubscriber.prototype._next = function (x) {
|
||
if (this.hasValue || (this.hasValue = this.hasSeed)) {
|
||
var result = tryCatch_1.tryCatch(this.project).call(this, this.acc, x);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.acc = result;
|
||
}
|
||
}
|
||
else {
|
||
this.acc = x;
|
||
this.hasValue = true;
|
||
}
|
||
};
|
||
ReduceSubscriber.prototype._complete = function () {
|
||
if (this.hasValue || this.hasSeed) {
|
||
this.destination.next(this.acc);
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
return ReduceSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
exports.ReduceSubscriber = ReduceSubscriber;
|
||
//# sourceMappingURL=reduce-support.js.map
|
||
},{"../Subscriber":20,"../util/errorObject":143,"../util/tryCatch":152}],91:[function(require,module,exports){
|
||
var reduce_support_1 = require('./reduce-support');
|
||
function reduce(project, seed) {
|
||
return this.lift(new reduce_support_1.ReduceOperator(project, seed));
|
||
}
|
||
exports.reduce = reduce;
|
||
//# sourceMappingURL=reduce.js.map
|
||
},{"./reduce-support":90}],92:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var EmptyObservable_1 = require('../observables/EmptyObservable');
|
||
function repeat(count) {
|
||
if (count === void 0) { count = -1; }
|
||
if (count === 0) {
|
||
return new EmptyObservable_1.EmptyObservable();
|
||
}
|
||
else {
|
||
return this.lift(new RepeatOperator(count, this));
|
||
}
|
||
}
|
||
exports.repeat = repeat;
|
||
var RepeatOperator = (function () {
|
||
function RepeatOperator(count, source) {
|
||
this.count = count;
|
||
this.source = source;
|
||
}
|
||
RepeatOperator.prototype.call = function (subscriber) {
|
||
return new FirstRepeatSubscriber(subscriber, this.count, this.source);
|
||
};
|
||
return RepeatOperator;
|
||
})();
|
||
var FirstRepeatSubscriber = (function (_super) {
|
||
__extends(FirstRepeatSubscriber, _super);
|
||
function FirstRepeatSubscriber(destination, count, source) {
|
||
_super.call(this, null);
|
||
this.destination = destination;
|
||
this.count = count;
|
||
this.source = source;
|
||
if (count === 0) {
|
||
this.destination.complete();
|
||
_super.prototype.unsubscribe.call(this);
|
||
}
|
||
this.lastSubscription = this;
|
||
}
|
||
FirstRepeatSubscriber.prototype._next = function (value) {
|
||
this.destination.next(value);
|
||
};
|
||
FirstRepeatSubscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
FirstRepeatSubscriber.prototype.complete = function () {
|
||
if (!this.isUnsubscribed) {
|
||
this.resubscribe(this.count);
|
||
}
|
||
};
|
||
FirstRepeatSubscriber.prototype.unsubscribe = function () {
|
||
var lastSubscription = this.lastSubscription;
|
||
if (lastSubscription === this) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
}
|
||
else {
|
||
lastSubscription.unsubscribe();
|
||
}
|
||
};
|
||
FirstRepeatSubscriber.prototype.resubscribe = function (count) {
|
||
this.lastSubscription.unsubscribe();
|
||
if (count - 1 === 0) {
|
||
this.destination.complete();
|
||
}
|
||
else {
|
||
var nextSubscriber = new MoreRepeatSubscriber(this, count - 1);
|
||
this.lastSubscription = this.source.subscribe(nextSubscriber);
|
||
}
|
||
};
|
||
return FirstRepeatSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var MoreRepeatSubscriber = (function (_super) {
|
||
__extends(MoreRepeatSubscriber, _super);
|
||
function MoreRepeatSubscriber(parent, count) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
this.count = count;
|
||
}
|
||
MoreRepeatSubscriber.prototype._next = function (value) {
|
||
this.parent.destination.next(value);
|
||
};
|
||
MoreRepeatSubscriber.prototype._error = function (err) {
|
||
this.parent.destination.error(err);
|
||
};
|
||
MoreRepeatSubscriber.prototype._complete = function () {
|
||
var count = this.count;
|
||
this.parent.resubscribe(count < 0 ? -1 : count);
|
||
};
|
||
return MoreRepeatSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=repeat.js.map
|
||
},{"../Subscriber":20,"../observables/EmptyObservable":25}],93:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function retry(count) {
|
||
if (count === void 0) { count = 0; }
|
||
return this.lift(new RetryOperator(count, this));
|
||
}
|
||
exports.retry = retry;
|
||
var RetryOperator = (function () {
|
||
function RetryOperator(count, source) {
|
||
this.count = count;
|
||
this.source = source;
|
||
}
|
||
RetryOperator.prototype.call = function (subscriber) {
|
||
return new FirstRetrySubscriber(subscriber, this.count, this.source);
|
||
};
|
||
return RetryOperator;
|
||
})();
|
||
var FirstRetrySubscriber = (function (_super) {
|
||
__extends(FirstRetrySubscriber, _super);
|
||
function FirstRetrySubscriber(destination, count, source) {
|
||
_super.call(this, null);
|
||
this.destination = destination;
|
||
this.count = count;
|
||
this.source = source;
|
||
this.lastSubscription = this;
|
||
}
|
||
FirstRetrySubscriber.prototype._next = function (value) {
|
||
this.destination.next(value);
|
||
};
|
||
FirstRetrySubscriber.prototype.error = function (error) {
|
||
if (!this.isUnsubscribed) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
this.resubscribe();
|
||
}
|
||
};
|
||
FirstRetrySubscriber.prototype._complete = function () {
|
||
_super.prototype.unsubscribe.call(this);
|
||
this.destination.complete();
|
||
};
|
||
FirstRetrySubscriber.prototype.unsubscribe = function () {
|
||
var lastSubscription = this.lastSubscription;
|
||
if (lastSubscription === this) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
}
|
||
else {
|
||
lastSubscription.unsubscribe();
|
||
}
|
||
};
|
||
FirstRetrySubscriber.prototype.resubscribe = function (retried) {
|
||
if (retried === void 0) { retried = 0; }
|
||
this.lastSubscription.unsubscribe();
|
||
var nextSubscriber = new RetryMoreSubscriber(this, this.count, retried + 1);
|
||
this.lastSubscription = this.source.subscribe(nextSubscriber);
|
||
};
|
||
return FirstRetrySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var RetryMoreSubscriber = (function (_super) {
|
||
__extends(RetryMoreSubscriber, _super);
|
||
function RetryMoreSubscriber(parent, count, retried) {
|
||
if (retried === void 0) { retried = 0; }
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
this.count = count;
|
||
this.retried = retried;
|
||
}
|
||
RetryMoreSubscriber.prototype._next = function (value) {
|
||
this.parent.destination.next(value);
|
||
};
|
||
RetryMoreSubscriber.prototype._error = function (err) {
|
||
var parent = this.parent;
|
||
var retried = this.retried;
|
||
var count = this.count;
|
||
if (count && retried === count) {
|
||
parent.destination.error(err);
|
||
}
|
||
else {
|
||
parent.resubscribe(retried);
|
||
}
|
||
};
|
||
RetryMoreSubscriber.prototype._complete = function () {
|
||
this.parent.destination.complete();
|
||
};
|
||
return RetryMoreSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=retry.js.map
|
||
},{"../Subscriber":20}],94:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subject_1 = require('../Subject');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function retryWhen(notifier) {
|
||
return this.lift(new RetryWhenOperator(notifier, this));
|
||
}
|
||
exports.retryWhen = retryWhen;
|
||
var RetryWhenOperator = (function () {
|
||
function RetryWhenOperator(notifier, source) {
|
||
this.notifier = notifier;
|
||
this.source = source;
|
||
}
|
||
RetryWhenOperator.prototype.call = function (subscriber) {
|
||
return new FirstRetryWhenSubscriber(subscriber, this.notifier, this.source);
|
||
};
|
||
return RetryWhenOperator;
|
||
})();
|
||
var FirstRetryWhenSubscriber = (function (_super) {
|
||
__extends(FirstRetryWhenSubscriber, _super);
|
||
function FirstRetryWhenSubscriber(destination, notifier, source) {
|
||
_super.call(this, null);
|
||
this.destination = destination;
|
||
this.notifier = notifier;
|
||
this.source = source;
|
||
this.lastSubscription = this;
|
||
}
|
||
FirstRetryWhenSubscriber.prototype._next = function (value) {
|
||
this.destination.next(value);
|
||
};
|
||
FirstRetryWhenSubscriber.prototype.error = function (err) {
|
||
if (!this.isUnsubscribed) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
if (!this.retryNotifications) {
|
||
this.errors = new Subject_1.Subject();
|
||
var notifications = tryCatch_1.tryCatch(this.notifier).call(this, this.errors);
|
||
if (notifications === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.retryNotifications = notifications;
|
||
var notificationSubscriber = new RetryNotificationSubscriber(this);
|
||
this.notificationSubscription = notifications.subscribe(notificationSubscriber);
|
||
}
|
||
}
|
||
this.errors.next(err);
|
||
}
|
||
};
|
||
FirstRetryWhenSubscriber.prototype.destinationError = function (err) {
|
||
this.tearDown();
|
||
this.destination.error(err);
|
||
};
|
||
FirstRetryWhenSubscriber.prototype._complete = function () {
|
||
this.destinationComplete();
|
||
};
|
||
FirstRetryWhenSubscriber.prototype.destinationComplete = function () {
|
||
this.tearDown();
|
||
this.destination.complete();
|
||
};
|
||
FirstRetryWhenSubscriber.prototype.unsubscribe = function () {
|
||
var lastSubscription = this.lastSubscription;
|
||
if (lastSubscription === this) {
|
||
_super.prototype.unsubscribe.call(this);
|
||
}
|
||
else {
|
||
this.tearDown();
|
||
}
|
||
};
|
||
FirstRetryWhenSubscriber.prototype.tearDown = function () {
|
||
_super.prototype.unsubscribe.call(this);
|
||
this.lastSubscription.unsubscribe();
|
||
var notificationSubscription = this.notificationSubscription;
|
||
if (notificationSubscription) {
|
||
notificationSubscription.unsubscribe();
|
||
}
|
||
};
|
||
FirstRetryWhenSubscriber.prototype.resubscribe = function () {
|
||
this.lastSubscription.unsubscribe();
|
||
var nextSubscriber = new MoreRetryWhenSubscriber(this);
|
||
this.lastSubscription = this.source.subscribe(nextSubscriber);
|
||
};
|
||
return FirstRetryWhenSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var MoreRetryWhenSubscriber = (function (_super) {
|
||
__extends(MoreRetryWhenSubscriber, _super);
|
||
function MoreRetryWhenSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
MoreRetryWhenSubscriber.prototype._next = function (value) {
|
||
this.parent.destination.next(value);
|
||
};
|
||
MoreRetryWhenSubscriber.prototype._error = function (err) {
|
||
this.parent.errors.next(err);
|
||
};
|
||
MoreRetryWhenSubscriber.prototype._complete = function () {
|
||
this.parent.destinationComplete();
|
||
};
|
||
return MoreRetryWhenSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var RetryNotificationSubscriber = (function (_super) {
|
||
__extends(RetryNotificationSubscriber, _super);
|
||
function RetryNotificationSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
RetryNotificationSubscriber.prototype._next = function (value) {
|
||
this.parent.resubscribe();
|
||
};
|
||
RetryNotificationSubscriber.prototype._error = function (err) {
|
||
this.parent.destinationError(err);
|
||
};
|
||
RetryNotificationSubscriber.prototype._complete = function () {
|
||
this.parent.destinationComplete();
|
||
};
|
||
return RetryNotificationSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=retryWhen.js.map
|
||
},{"../Subject":19,"../Subscriber":20,"../util/errorObject":143,"../util/tryCatch":152}],95:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function sample(notifier) {
|
||
return this.lift(new SampleOperator(notifier));
|
||
}
|
||
exports.sample = sample;
|
||
var SampleOperator = (function () {
|
||
function SampleOperator(notifier) {
|
||
this.notifier = notifier;
|
||
}
|
||
SampleOperator.prototype.call = function (subscriber) {
|
||
return new SampleSubscriber(subscriber, this.notifier);
|
||
};
|
||
return SampleOperator;
|
||
})();
|
||
var SampleSubscriber = (function (_super) {
|
||
__extends(SampleSubscriber, _super);
|
||
function SampleSubscriber(destination, notifier) {
|
||
_super.call(this, destination);
|
||
this.notifier = notifier;
|
||
this.hasValue = false;
|
||
this.add(notifier._subscribe(new SampleNoficationSubscriber(this)));
|
||
}
|
||
SampleSubscriber.prototype._next = function (value) {
|
||
this.lastValue = value;
|
||
this.hasValue = true;
|
||
};
|
||
SampleSubscriber.prototype.notifyNext = function () {
|
||
if (this.hasValue) {
|
||
this.destination.next(this.lastValue);
|
||
}
|
||
};
|
||
return SampleSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var SampleNoficationSubscriber = (function (_super) {
|
||
__extends(SampleNoficationSubscriber, _super);
|
||
function SampleNoficationSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
SampleNoficationSubscriber.prototype._next = function () {
|
||
this.parent.notifyNext();
|
||
};
|
||
SampleNoficationSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
SampleNoficationSubscriber.prototype._complete = function () {
|
||
//noop
|
||
};
|
||
return SampleNoficationSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=sample.js.map
|
||
},{"../Subscriber":20}],96:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
function sampleTime(delay, scheduler) {
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return this.lift(new SampleTimeOperator(delay, scheduler));
|
||
}
|
||
exports.sampleTime = sampleTime;
|
||
var SampleTimeOperator = (function () {
|
||
function SampleTimeOperator(delay, scheduler) {
|
||
this.delay = delay;
|
||
this.scheduler = scheduler;
|
||
}
|
||
SampleTimeOperator.prototype.call = function (subscriber) {
|
||
return new SampleTimeSubscriber(subscriber, this.delay, this.scheduler);
|
||
};
|
||
return SampleTimeOperator;
|
||
})();
|
||
var SampleTimeSubscriber = (function (_super) {
|
||
__extends(SampleTimeSubscriber, _super);
|
||
function SampleTimeSubscriber(destination, delay, scheduler) {
|
||
_super.call(this, destination);
|
||
this.delay = delay;
|
||
this.scheduler = scheduler;
|
||
this.hasValue = false;
|
||
this.add(scheduler.schedule(dispatchNotification, delay, { subscriber: this, delay: delay }));
|
||
}
|
||
SampleTimeSubscriber.prototype._next = function (value) {
|
||
this.lastValue = value;
|
||
this.hasValue = true;
|
||
};
|
||
SampleTimeSubscriber.prototype.notifyNext = function () {
|
||
if (this.hasValue) {
|
||
this.destination.next(this.lastValue);
|
||
}
|
||
};
|
||
return SampleTimeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
function dispatchNotification(state) {
|
||
var subscriber = state.subscriber, delay = state.delay;
|
||
subscriber.notifyNext();
|
||
this.schedule(state, delay);
|
||
}
|
||
//# sourceMappingURL=sampleTime.js.map
|
||
},{"../Subscriber":20,"../schedulers/nextTick":130}],97:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function scan(project, acc) {
|
||
return this.lift(new ScanOperator(project, acc));
|
||
}
|
||
exports.scan = scan;
|
||
var ScanOperator = (function () {
|
||
function ScanOperator(project, acc) {
|
||
this.acc = acc;
|
||
this.project = project;
|
||
}
|
||
ScanOperator.prototype.call = function (subscriber) {
|
||
return new ScanSubscriber(subscriber, this.project, this.acc);
|
||
};
|
||
return ScanOperator;
|
||
})();
|
||
var ScanSubscriber = (function (_super) {
|
||
__extends(ScanSubscriber, _super);
|
||
function ScanSubscriber(destination, project, acc) {
|
||
_super.call(this, destination);
|
||
this.accumulatorSet = false;
|
||
this.acc = acc;
|
||
this.project = project;
|
||
this.accumulatorSet = typeof acc !== 'undefined';
|
||
}
|
||
Object.defineProperty(ScanSubscriber.prototype, "acc", {
|
||
get: function () {
|
||
return this._acc;
|
||
},
|
||
set: function (value) {
|
||
this.accumulatorSet = true;
|
||
this._acc = value;
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
ScanSubscriber.prototype._next = function (x) {
|
||
if (!this.accumulatorSet) {
|
||
this.acc = x;
|
||
this.destination.next(x);
|
||
}
|
||
else {
|
||
var result = tryCatch_1.tryCatch(this.project).call(this, this.acc, x);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
this.acc = result;
|
||
this.destination.next(this.acc);
|
||
}
|
||
}
|
||
};
|
||
return ScanSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=scan.js.map
|
||
},{"../Subscriber":20,"../util/errorObject":143,"../util/tryCatch":152}],98:[function(require,module,exports){
|
||
var multicast_1 = require('./multicast');
|
||
var Subject_1 = require('../Subject');
|
||
function shareSubjectFactory() {
|
||
return new Subject_1.Subject();
|
||
}
|
||
function share() {
|
||
return multicast_1.multicast.call(this, shareSubjectFactory).refCount();
|
||
}
|
||
exports.share = share;
|
||
;
|
||
//# sourceMappingURL=share.js.map
|
||
},{"../Subject":19,"./multicast":83}],99:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var bindCallback_1 = require('../util/bindCallback');
|
||
var EmptyError_1 = require('../util/EmptyError');
|
||
function single(predicate, thisArg) {
|
||
return this.lift(new SingleOperator(predicate, thisArg, this));
|
||
}
|
||
exports.single = single;
|
||
var SingleOperator = (function () {
|
||
function SingleOperator(predicate, thisArg, source) {
|
||
this.predicate = predicate;
|
||
this.thisArg = thisArg;
|
||
this.source = source;
|
||
}
|
||
SingleOperator.prototype.call = function (subscriber) {
|
||
return new SingleSubscriber(subscriber, this.predicate, this.thisArg, this.source);
|
||
};
|
||
return SingleOperator;
|
||
})();
|
||
var SingleSubscriber = (function (_super) {
|
||
__extends(SingleSubscriber, _super);
|
||
function SingleSubscriber(destination, predicate, thisArg, source) {
|
||
_super.call(this, destination);
|
||
this.thisArg = thisArg;
|
||
this.source = source;
|
||
this.seenValue = false;
|
||
this.index = 0;
|
||
if (typeof predicate === 'function') {
|
||
this.predicate = bindCallback_1.bindCallback(predicate, thisArg, 3);
|
||
}
|
||
}
|
||
SingleSubscriber.prototype.applySingleValue = function (value) {
|
||
if (this.seenValue) {
|
||
this.destination.error('Sequence contains more than one element');
|
||
}
|
||
else {
|
||
this.seenValue = true;
|
||
this.singleValue = value;
|
||
}
|
||
};
|
||
SingleSubscriber.prototype._next = function (value) {
|
||
var predicate = this.predicate;
|
||
var currentIndex = this.index++;
|
||
if (predicate) {
|
||
var result = tryCatch_1.tryCatch(predicate)(value, currentIndex, this.source);
|
||
if (result === errorObject_1.errorObject) {
|
||
this.destination.error(result.e);
|
||
}
|
||
else if (result) {
|
||
this.applySingleValue(value);
|
||
}
|
||
}
|
||
else {
|
||
this.applySingleValue(value);
|
||
}
|
||
};
|
||
SingleSubscriber.prototype._complete = function () {
|
||
var destination = this.destination;
|
||
if (this.index > 0) {
|
||
destination.next(this.seenValue ? this.singleValue : undefined);
|
||
destination.complete();
|
||
}
|
||
else {
|
||
destination.error(new EmptyError_1.EmptyError);
|
||
}
|
||
};
|
||
return SingleSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=single.js.map
|
||
},{"../Subscriber":20,"../util/EmptyError":135,"../util/bindCallback":142,"../util/errorObject":143,"../util/tryCatch":152}],100:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function skip(total) {
|
||
return this.lift(new SkipOperator(total));
|
||
}
|
||
exports.skip = skip;
|
||
var SkipOperator = (function () {
|
||
function SkipOperator(total) {
|
||
this.total = total;
|
||
}
|
||
SkipOperator.prototype.call = function (subscriber) {
|
||
return new SkipSubscriber(subscriber, this.total);
|
||
};
|
||
return SkipOperator;
|
||
})();
|
||
var SkipSubscriber = (function (_super) {
|
||
__extends(SkipSubscriber, _super);
|
||
function SkipSubscriber(destination, total) {
|
||
_super.call(this, destination);
|
||
this.total = total;
|
||
this.count = 0;
|
||
}
|
||
SkipSubscriber.prototype._next = function (x) {
|
||
if (++this.count > this.total) {
|
||
this.destination.next(x);
|
||
}
|
||
};
|
||
return SkipSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=skip.js.map
|
||
},{"../Subscriber":20}],101:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function skipUntil(notifier) {
|
||
return this.lift(new SkipUntilOperator(notifier));
|
||
}
|
||
exports.skipUntil = skipUntil;
|
||
var SkipUntilOperator = (function () {
|
||
function SkipUntilOperator(notifier) {
|
||
this.notifier = notifier;
|
||
}
|
||
SkipUntilOperator.prototype.call = function (subscriber) {
|
||
return new SkipUntilSubscriber(subscriber, this.notifier);
|
||
};
|
||
return SkipUntilOperator;
|
||
})();
|
||
var SkipUntilSubscriber = (function (_super) {
|
||
__extends(SkipUntilSubscriber, _super);
|
||
function SkipUntilSubscriber(destination, notifier) {
|
||
_super.call(this, destination);
|
||
this.notifier = notifier;
|
||
this.notificationSubscriber = null;
|
||
this.notificationSubscriber = new NotificationSubscriber(this);
|
||
this.add(this.notifier.subscribe(this.notificationSubscriber));
|
||
}
|
||
SkipUntilSubscriber.prototype._next = function (value) {
|
||
if (this.notificationSubscriber.hasValue) {
|
||
this.destination.next(value);
|
||
}
|
||
};
|
||
SkipUntilSubscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
SkipUntilSubscriber.prototype._complete = function () {
|
||
if (this.notificationSubscriber.hasCompleted) {
|
||
this.destination.complete();
|
||
}
|
||
this.notificationSubscriber.unsubscribe();
|
||
};
|
||
SkipUntilSubscriber.prototype.unsubscribe = function () {
|
||
if (this._isUnsubscribed) {
|
||
return;
|
||
}
|
||
else if (this._subscription) {
|
||
this._subscription.unsubscribe();
|
||
this._isUnsubscribed = true;
|
||
}
|
||
else {
|
||
_super.prototype.unsubscribe.call(this);
|
||
}
|
||
};
|
||
return SkipUntilSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var NotificationSubscriber = (function (_super) {
|
||
__extends(NotificationSubscriber, _super);
|
||
function NotificationSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
this.hasValue = false;
|
||
this.hasCompleted = false;
|
||
}
|
||
NotificationSubscriber.prototype._next = function (unused) {
|
||
this.hasValue = true;
|
||
};
|
||
NotificationSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
this.hasValue = true;
|
||
};
|
||
NotificationSubscriber.prototype._complete = function () {
|
||
this.hasCompleted = true;
|
||
};
|
||
return NotificationSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=skipUntil.js.map
|
||
},{"../Subscriber":20}],102:[function(require,module,exports){
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
var ScalarObservable_1 = require('../observables/ScalarObservable');
|
||
var EmptyObservable_1 = require('../observables/EmptyObservable');
|
||
var concat_static_1 = require('./concat-static');
|
||
function startWith() {
|
||
var array = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
array[_i - 0] = arguments[_i];
|
||
}
|
||
var scheduler = array[array.length - 1];
|
||
if (scheduler && typeof scheduler.schedule === 'function') {
|
||
array.pop();
|
||
}
|
||
else {
|
||
scheduler = void 0;
|
||
}
|
||
var len = array.length;
|
||
if (len === 1) {
|
||
return concat_static_1.concat(new ScalarObservable_1.ScalarObservable(array[0], scheduler), this);
|
||
}
|
||
else if (len > 1) {
|
||
return concat_static_1.concat(new ArrayObservable_1.ArrayObservable(array, scheduler), this);
|
||
}
|
||
else {
|
||
return concat_static_1.concat(new EmptyObservable_1.EmptyObservable(scheduler), this);
|
||
}
|
||
}
|
||
exports.startWith = startWith;
|
||
//# sourceMappingURL=startWith.js.map
|
||
},{"../observables/ArrayObservable":22,"../observables/EmptyObservable":25,"../observables/ScalarObservable":36,"./concat-static":49}],103:[function(require,module,exports){
|
||
var SubscribeOnObservable_1 = require('../observables/SubscribeOnObservable');
|
||
function subscribeOn(scheduler, delay) {
|
||
if (delay === void 0) { delay = 0; }
|
||
return new SubscribeOnObservable_1.SubscribeOnObservable(this, delay, scheduler);
|
||
}
|
||
exports.subscribeOn = subscribeOn;
|
||
//# sourceMappingURL=subscribeOn.js.map
|
||
},{"../observables/SubscribeOnObservable":37}],104:[function(require,module,exports){
|
||
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 OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
function _switch() {
|
||
return this.lift(new SwitchOperator());
|
||
}
|
||
exports._switch = _switch;
|
||
var SwitchOperator = (function () {
|
||
function SwitchOperator() {
|
||
}
|
||
SwitchOperator.prototype.call = function (subscriber) {
|
||
return new SwitchSubscriber(subscriber);
|
||
};
|
||
return SwitchOperator;
|
||
})();
|
||
var SwitchSubscriber = (function (_super) {
|
||
__extends(SwitchSubscriber, _super);
|
||
function SwitchSubscriber(destination) {
|
||
_super.call(this, destination);
|
||
this.active = 0;
|
||
this.hasCompleted = false;
|
||
}
|
||
SwitchSubscriber.prototype._next = function (value) {
|
||
this.unsubscribeInner();
|
||
this.active++;
|
||
this.add(this.innerSubscription = subscribeToResult_1.subscribeToResult(this, value));
|
||
};
|
||
SwitchSubscriber.prototype._complete = function () {
|
||
this.hasCompleted = true;
|
||
if (this.active === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
SwitchSubscriber.prototype.unsubscribeInner = function () {
|
||
this.active = this.active > 0 ? this.active - 1 : 0;
|
||
var innerSubscription = this.innerSubscription;
|
||
if (innerSubscription) {
|
||
innerSubscription.unsubscribe();
|
||
this.remove(innerSubscription);
|
||
}
|
||
};
|
||
SwitchSubscriber.prototype.notifyNext = function (outerValue, innerValue) {
|
||
this.destination.next(innerValue);
|
||
};
|
||
SwitchSubscriber.prototype.notifyError = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
SwitchSubscriber.prototype.notifyComplete = function () {
|
||
this.unsubscribeInner();
|
||
if (this.hasCompleted && this.active === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
return SwitchSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
//# sourceMappingURL=switch.js.map
|
||
},{"../OuterSubscriber":17,"../util/subscribeToResult":150}],105:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
function switchMap(project, resultSelector) {
|
||
return this.lift(new SwitchMapOperator(project, resultSelector));
|
||
}
|
||
exports.switchMap = switchMap;
|
||
var SwitchMapOperator = (function () {
|
||
function SwitchMapOperator(project, resultSelector) {
|
||
this.project = project;
|
||
this.resultSelector = resultSelector;
|
||
}
|
||
SwitchMapOperator.prototype.call = function (subscriber) {
|
||
return new SwitchMapSubscriber(subscriber, this.project, this.resultSelector);
|
||
};
|
||
return SwitchMapOperator;
|
||
})();
|
||
var SwitchMapSubscriber = (function (_super) {
|
||
__extends(SwitchMapSubscriber, _super);
|
||
function SwitchMapSubscriber(destination, project, resultSelector) {
|
||
_super.call(this, destination);
|
||
this.project = project;
|
||
this.resultSelector = resultSelector;
|
||
this.hasCompleted = false;
|
||
this.index = 0;
|
||
}
|
||
SwitchMapSubscriber.prototype._next = function (value) {
|
||
var index = this.index++;
|
||
var destination = this.destination;
|
||
var result = tryCatch_1.tryCatch(this.project)(value, index);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(result.e);
|
||
}
|
||
else {
|
||
var innerSubscription = this.innerSubscription;
|
||
if (innerSubscription) {
|
||
innerSubscription.unsubscribe();
|
||
}
|
||
this.add(this.innerSubscription = subscribeToResult_1.subscribeToResult(this, result, value, index));
|
||
}
|
||
};
|
||
SwitchMapSubscriber.prototype._complete = function () {
|
||
var innerSubscription = this.innerSubscription;
|
||
this.hasCompleted = true;
|
||
if (!innerSubscription || innerSubscription.isUnsubscribed) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
SwitchMapSubscriber.prototype.notifyComplete = function (innerSub) {
|
||
this.remove(innerSub);
|
||
var prevSubscription = this.innerSubscription;
|
||
if (prevSubscription) {
|
||
prevSubscription.unsubscribe();
|
||
}
|
||
this.innerSubscription = null;
|
||
if (this.hasCompleted) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
SwitchMapSubscriber.prototype.notifyError = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
SwitchMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
var _a = this, resultSelector = _a.resultSelector, destination = _a.destination;
|
||
if (resultSelector) {
|
||
var result = tryCatch_1.tryCatch(resultSelector)(outerValue, innerValue, outerIndex, innerIndex);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(innerValue);
|
||
}
|
||
};
|
||
return SwitchMapSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
//# sourceMappingURL=switchMap.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],106:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
function switchMapTo(observable, projectResult) {
|
||
return this.lift(new SwitchMapToOperator(observable, projectResult));
|
||
}
|
||
exports.switchMapTo = switchMapTo;
|
||
var SwitchMapToOperator = (function () {
|
||
function SwitchMapToOperator(observable, resultSelector) {
|
||
this.observable = observable;
|
||
this.resultSelector = resultSelector;
|
||
}
|
||
SwitchMapToOperator.prototype.call = function (subscriber) {
|
||
return new SwitchMapToSubscriber(subscriber, this.observable, this.resultSelector);
|
||
};
|
||
return SwitchMapToOperator;
|
||
})();
|
||
var SwitchMapToSubscriber = (function (_super) {
|
||
__extends(SwitchMapToSubscriber, _super);
|
||
function SwitchMapToSubscriber(destination, inner, resultSelector) {
|
||
_super.call(this, destination);
|
||
this.inner = inner;
|
||
this.resultSelector = resultSelector;
|
||
this.hasCompleted = false;
|
||
this.index = 0;
|
||
}
|
||
SwitchMapToSubscriber.prototype._next = function (value) {
|
||
var index = this.index++;
|
||
var innerSubscription = this.innerSubscription;
|
||
if (innerSubscription) {
|
||
innerSubscription.unsubscribe();
|
||
}
|
||
this.add(this.innerSubscription = subscribeToResult_1.subscribeToResult(this, this.inner, value, index));
|
||
};
|
||
SwitchMapToSubscriber.prototype._complete = function () {
|
||
var innerSubscription = this.innerSubscription;
|
||
this.hasCompleted = true;
|
||
if (!innerSubscription || innerSubscription.isUnsubscribed) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
SwitchMapToSubscriber.prototype.notifyComplete = function (innerSub) {
|
||
this.remove(innerSub);
|
||
var prevSubscription = this.innerSubscription;
|
||
if (prevSubscription) {
|
||
prevSubscription.unsubscribe();
|
||
}
|
||
this.innerSubscription = null;
|
||
if (this.hasCompleted) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
SwitchMapToSubscriber.prototype.notifyError = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
SwitchMapToSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
var _a = this, resultSelector = _a.resultSelector, destination = _a.destination;
|
||
if (resultSelector) {
|
||
var result = tryCatch_1.tryCatch(resultSelector)(outerValue, innerValue, outerIndex, innerIndex);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(innerValue);
|
||
}
|
||
};
|
||
return SwitchMapToSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
//# sourceMappingURL=switchMapTo.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],107:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var ArgumentOutOfRangeError_1 = require('../util/ArgumentOutOfRangeError');
|
||
var EmptyObservable_1 = require('../observables/EmptyObservable');
|
||
function take(total) {
|
||
if (total === 0) {
|
||
return new EmptyObservable_1.EmptyObservable();
|
||
}
|
||
else {
|
||
return this.lift(new TakeOperator(total));
|
||
}
|
||
}
|
||
exports.take = take;
|
||
var TakeOperator = (function () {
|
||
function TakeOperator(total) {
|
||
this.total = total;
|
||
if (this.total < 0) {
|
||
throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;
|
||
}
|
||
}
|
||
TakeOperator.prototype.call = function (subscriber) {
|
||
return new TakeSubscriber(subscriber, this.total);
|
||
};
|
||
return TakeOperator;
|
||
})();
|
||
var TakeSubscriber = (function (_super) {
|
||
__extends(TakeSubscriber, _super);
|
||
function TakeSubscriber(destination, total) {
|
||
_super.call(this, destination);
|
||
this.total = total;
|
||
this.count = 0;
|
||
}
|
||
TakeSubscriber.prototype._next = function (value) {
|
||
var total = this.total;
|
||
if (++this.count <= total) {
|
||
this.destination.next(value);
|
||
if (this.count === total) {
|
||
this.destination.complete();
|
||
}
|
||
}
|
||
};
|
||
return TakeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=take.js.map
|
||
},{"../Subscriber":20,"../observables/EmptyObservable":25,"../util/ArgumentOutOfRangeError":134}],108:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var noop_1 = require('../util/noop');
|
||
function takeUntil(notifier) {
|
||
return this.lift(new TakeUntilOperator(notifier));
|
||
}
|
||
exports.takeUntil = takeUntil;
|
||
var TakeUntilOperator = (function () {
|
||
function TakeUntilOperator(notifier) {
|
||
this.notifier = notifier;
|
||
}
|
||
TakeUntilOperator.prototype.call = function (subscriber) {
|
||
return new TakeUntilSubscriber(subscriber, this.notifier);
|
||
};
|
||
return TakeUntilOperator;
|
||
})();
|
||
var TakeUntilSubscriber = (function (_super) {
|
||
__extends(TakeUntilSubscriber, _super);
|
||
function TakeUntilSubscriber(destination, notifier) {
|
||
_super.call(this, destination);
|
||
this.notifier = notifier;
|
||
this.notificationSubscriber = null;
|
||
this.notificationSubscriber = new TakeUntilInnerSubscriber(destination);
|
||
this.add(notifier.subscribe(this.notificationSubscriber));
|
||
}
|
||
TakeUntilSubscriber.prototype._complete = function () {
|
||
this.destination.complete();
|
||
this.notificationSubscriber.unsubscribe();
|
||
};
|
||
return TakeUntilSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var TakeUntilInnerSubscriber = (function (_super) {
|
||
__extends(TakeUntilInnerSubscriber, _super);
|
||
function TakeUntilInnerSubscriber(destination) {
|
||
_super.call(this, null);
|
||
this.destination = destination;
|
||
}
|
||
TakeUntilInnerSubscriber.prototype._next = function (unused) {
|
||
this.destination.complete();
|
||
};
|
||
TakeUntilInnerSubscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
};
|
||
TakeUntilInnerSubscriber.prototype._complete = function () {
|
||
noop_1.noop();
|
||
};
|
||
return TakeUntilInnerSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=takeUntil.js.map
|
||
},{"../Subscriber":20,"../util/noop":147}],109:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
function throttle(delay, scheduler) {
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return this.lift(new ThrottleOperator(delay, scheduler));
|
||
}
|
||
exports.throttle = throttle;
|
||
var ThrottleOperator = (function () {
|
||
function ThrottleOperator(delay, scheduler) {
|
||
this.delay = delay;
|
||
this.scheduler = scheduler;
|
||
}
|
||
ThrottleOperator.prototype.call = function (subscriber) {
|
||
return new ThrottleSubscriber(subscriber, this.delay, this.scheduler);
|
||
};
|
||
return ThrottleOperator;
|
||
})();
|
||
var ThrottleSubscriber = (function (_super) {
|
||
__extends(ThrottleSubscriber, _super);
|
||
function ThrottleSubscriber(destination, delay, scheduler) {
|
||
_super.call(this, destination);
|
||
this.delay = delay;
|
||
this.scheduler = scheduler;
|
||
}
|
||
ThrottleSubscriber.prototype._next = function (value) {
|
||
if (!this.throttled) {
|
||
this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.delay, { value: value, subscriber: this }));
|
||
}
|
||
};
|
||
ThrottleSubscriber.prototype.throttledNext = function (value) {
|
||
this.clearThrottle();
|
||
this.destination.next(value);
|
||
};
|
||
ThrottleSubscriber.prototype.clearThrottle = function () {
|
||
var throttled = this.throttled;
|
||
if (throttled) {
|
||
throttled.unsubscribe();
|
||
this.remove(throttled);
|
||
}
|
||
};
|
||
return ThrottleSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
function dispatchNext(_a) {
|
||
var value = _a.value, subscriber = _a.subscriber;
|
||
subscriber.throttledNext(value);
|
||
}
|
||
//# sourceMappingURL=throttle.js.map
|
||
},{"../Subscriber":20,"../schedulers/nextTick":130}],110:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var immediate_1 = require('../schedulers/immediate');
|
||
var isDate_1 = require('../util/isDate');
|
||
function timeout(due, errorToSend, scheduler) {
|
||
if (errorToSend === void 0) { errorToSend = null; }
|
||
if (scheduler === void 0) { scheduler = immediate_1.immediate; }
|
||
var absoluteTimeout = isDate_1.isDate(due);
|
||
var waitFor = absoluteTimeout ? (+due - scheduler.now()) : due;
|
||
return this.lift(new TimeoutOperator(waitFor, absoluteTimeout, errorToSend, scheduler));
|
||
}
|
||
exports.timeout = timeout;
|
||
var TimeoutOperator = (function () {
|
||
function TimeoutOperator(waitFor, absoluteTimeout, errorToSend, scheduler) {
|
||
this.waitFor = waitFor;
|
||
this.absoluteTimeout = absoluteTimeout;
|
||
this.errorToSend = errorToSend;
|
||
this.scheduler = scheduler;
|
||
}
|
||
TimeoutOperator.prototype.call = function (subscriber) {
|
||
return new TimeoutSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.errorToSend, this.scheduler);
|
||
};
|
||
return TimeoutOperator;
|
||
})();
|
||
var TimeoutSubscriber = (function (_super) {
|
||
__extends(TimeoutSubscriber, _super);
|
||
function TimeoutSubscriber(destination, absoluteTimeout, waitFor, errorToSend, scheduler) {
|
||
_super.call(this, destination);
|
||
this.absoluteTimeout = absoluteTimeout;
|
||
this.waitFor = waitFor;
|
||
this.errorToSend = errorToSend;
|
||
this.scheduler = scheduler;
|
||
this.index = 0;
|
||
this._previousIndex = 0;
|
||
this._hasCompleted = false;
|
||
this.scheduleTimeout();
|
||
}
|
||
Object.defineProperty(TimeoutSubscriber.prototype, "previousIndex", {
|
||
get: function () {
|
||
return this._previousIndex;
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
Object.defineProperty(TimeoutSubscriber.prototype, "hasCompleted", {
|
||
get: function () {
|
||
return this._hasCompleted;
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
TimeoutSubscriber.dispatchTimeout = function (state) {
|
||
var source = state.subscriber;
|
||
var currentIndex = state.index;
|
||
if (!source.hasCompleted && source.previousIndex === currentIndex) {
|
||
source.notifyTimeout();
|
||
}
|
||
};
|
||
TimeoutSubscriber.prototype.scheduleTimeout = function () {
|
||
var currentIndex = this.index;
|
||
this.scheduler.schedule(TimeoutSubscriber.dispatchTimeout, this.waitFor, { subscriber: this, index: currentIndex });
|
||
this.index++;
|
||
this._previousIndex = currentIndex;
|
||
};
|
||
TimeoutSubscriber.prototype._next = function (value) {
|
||
this.destination.next(value);
|
||
if (!this.absoluteTimeout) {
|
||
this.scheduleTimeout();
|
||
}
|
||
};
|
||
TimeoutSubscriber.prototype._error = function (err) {
|
||
this.destination.error(err);
|
||
this._hasCompleted = true;
|
||
};
|
||
TimeoutSubscriber.prototype._complete = function () {
|
||
this.destination.complete();
|
||
this._hasCompleted = true;
|
||
};
|
||
TimeoutSubscriber.prototype.notifyTimeout = function () {
|
||
this.error(this.errorToSend || new Error('timeout'));
|
||
};
|
||
return TimeoutSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=timeout.js.map
|
||
},{"../Subscriber":20,"../schedulers/immediate":129,"../util/isDate":144}],111:[function(require,module,exports){
|
||
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 immediate_1 = require('../schedulers/immediate');
|
||
var isDate_1 = require('../util/isDate');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
function timeoutWith(due, withObservable, scheduler) {
|
||
if (scheduler === void 0) { scheduler = immediate_1.immediate; }
|
||
var absoluteTimeout = isDate_1.isDate(due);
|
||
var waitFor = absoluteTimeout ? (+due - scheduler.now()) : due;
|
||
return this.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler));
|
||
}
|
||
exports.timeoutWith = timeoutWith;
|
||
var TimeoutWithOperator = (function () {
|
||
function TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler) {
|
||
this.waitFor = waitFor;
|
||
this.absoluteTimeout = absoluteTimeout;
|
||
this.withObservable = withObservable;
|
||
this.scheduler = scheduler;
|
||
}
|
||
TimeoutWithOperator.prototype.call = function (subscriber) {
|
||
return new TimeoutWithSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.withObservable, this.scheduler);
|
||
};
|
||
return TimeoutWithOperator;
|
||
})();
|
||
var TimeoutWithSubscriber = (function (_super) {
|
||
__extends(TimeoutWithSubscriber, _super);
|
||
function TimeoutWithSubscriber(destination, absoluteTimeout, waitFor, withObservable, scheduler) {
|
||
_super.call(this, destination);
|
||
this.absoluteTimeout = absoluteTimeout;
|
||
this.waitFor = waitFor;
|
||
this.withObservable = withObservable;
|
||
this.scheduler = scheduler;
|
||
this.timeoutSubscription = undefined;
|
||
this.timedOut = false;
|
||
this.index = 0;
|
||
this._previousIndex = 0;
|
||
this._hasCompleted = false;
|
||
this.scheduleTimeout();
|
||
}
|
||
Object.defineProperty(TimeoutWithSubscriber.prototype, "previousIndex", {
|
||
get: function () {
|
||
return this._previousIndex;
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
Object.defineProperty(TimeoutWithSubscriber.prototype, "hasCompleted", {
|
||
get: function () {
|
||
return this._hasCompleted;
|
||
},
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
TimeoutWithSubscriber.dispatchTimeout = function (state) {
|
||
var source = state.subscriber;
|
||
var currentIndex = state.index;
|
||
if (!source.hasCompleted && source.previousIndex === currentIndex) {
|
||
source.handleTimeout();
|
||
}
|
||
};
|
||
TimeoutWithSubscriber.prototype.scheduleTimeout = function () {
|
||
var currentIndex = this.index;
|
||
var timeoutState = { subscriber: this, index: currentIndex };
|
||
this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout, this.waitFor, timeoutState);
|
||
this.index++;
|
||
this._previousIndex = currentIndex;
|
||
};
|
||
TimeoutWithSubscriber.prototype._next = function (value) {
|
||
if (!this.timedOut) {
|
||
this.destination.next(value);
|
||
if (!this.absoluteTimeout) {
|
||
this.scheduleTimeout();
|
||
}
|
||
}
|
||
};
|
||
TimeoutWithSubscriber.prototype._error = function (err) {
|
||
if (!this.timedOut) {
|
||
this.destination.error(err);
|
||
this._hasCompleted = true;
|
||
}
|
||
};
|
||
TimeoutWithSubscriber.prototype._complete = function () {
|
||
if (!this.timedOut) {
|
||
this.destination.complete();
|
||
this._hasCompleted = true;
|
||
}
|
||
};
|
||
TimeoutWithSubscriber.prototype.handleTimeout = function () {
|
||
var withObservable = this.withObservable;
|
||
this.timedOut = true;
|
||
this.add(this.timeoutSubscription = subscribeToResult_1.subscribeToResult(this, withObservable));
|
||
};
|
||
return TimeoutWithSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
//# sourceMappingURL=timeoutWith.js.map
|
||
},{"../OuterSubscriber":17,"../schedulers/immediate":129,"../util/isDate":144,"../util/subscribeToResult":150}],112:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
function toArray() {
|
||
return this.lift(new ToArrayOperator());
|
||
}
|
||
exports.toArray = toArray;
|
||
var ToArrayOperator = (function () {
|
||
function ToArrayOperator() {
|
||
}
|
||
ToArrayOperator.prototype.call = function (subscriber) {
|
||
return new ToArraySubscriber(subscriber);
|
||
};
|
||
return ToArrayOperator;
|
||
})();
|
||
var ToArraySubscriber = (function (_super) {
|
||
__extends(ToArraySubscriber, _super);
|
||
function ToArraySubscriber(destination) {
|
||
_super.call(this, destination);
|
||
this.array = [];
|
||
}
|
||
ToArraySubscriber.prototype._next = function (x) {
|
||
this.array.push(x);
|
||
};
|
||
ToArraySubscriber.prototype._complete = function () {
|
||
this.destination.next(this.array);
|
||
this.destination.complete();
|
||
};
|
||
return ToArraySubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=toArray.js.map
|
||
},{"../Subscriber":20}],113:[function(require,module,exports){
|
||
var root_1 = require('../util/root');
|
||
function toPromise(PromiseCtor) {
|
||
var _this = this;
|
||
if (!PromiseCtor) {
|
||
if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
|
||
PromiseCtor = root_1.root.Rx.config.Promise;
|
||
}
|
||
else if (root_1.root.Promise) {
|
||
PromiseCtor = root_1.root.Promise;
|
||
}
|
||
}
|
||
if (!PromiseCtor) {
|
||
throw new Error('no Promise impl found');
|
||
}
|
||
return new PromiseCtor(function (resolve, reject) {
|
||
var value;
|
||
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
|
||
});
|
||
}
|
||
exports.toPromise = toPromise;
|
||
//# sourceMappingURL=toPromise.js.map
|
||
},{"../util/root":149}],114:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subject_1 = require('../Subject');
|
||
function window(closingNotifier) {
|
||
return this.lift(new WindowOperator(closingNotifier));
|
||
}
|
||
exports.window = window;
|
||
var WindowOperator = (function () {
|
||
function WindowOperator(closingNotifier) {
|
||
this.closingNotifier = closingNotifier;
|
||
}
|
||
WindowOperator.prototype.call = function (subscriber) {
|
||
return new WindowSubscriber(subscriber, this.closingNotifier);
|
||
};
|
||
return WindowOperator;
|
||
})();
|
||
var WindowSubscriber = (function (_super) {
|
||
__extends(WindowSubscriber, _super);
|
||
function WindowSubscriber(destination, closingNotifier) {
|
||
_super.call(this, destination);
|
||
this.closingNotifier = closingNotifier;
|
||
this.window = new Subject_1.Subject();
|
||
this.add(closingNotifier._subscribe(new WindowClosingNotifierSubscriber(this)));
|
||
this.openWindow();
|
||
}
|
||
WindowSubscriber.prototype._next = function (value) {
|
||
this.window.next(value);
|
||
};
|
||
WindowSubscriber.prototype._error = function (err) {
|
||
this.window.error(err);
|
||
this.destination.error(err);
|
||
};
|
||
WindowSubscriber.prototype._complete = function () {
|
||
this.window.complete();
|
||
this.destination.complete();
|
||
};
|
||
WindowSubscriber.prototype.openWindow = function () {
|
||
var prevWindow = this.window;
|
||
if (prevWindow) {
|
||
prevWindow.complete();
|
||
}
|
||
this.destination.next(this.window = new Subject_1.Subject());
|
||
};
|
||
return WindowSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var WindowClosingNotifierSubscriber = (function (_super) {
|
||
__extends(WindowClosingNotifierSubscriber, _super);
|
||
function WindowClosingNotifierSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
WindowClosingNotifierSubscriber.prototype._next = function () {
|
||
this.parent.openWindow();
|
||
};
|
||
WindowClosingNotifierSubscriber.prototype._error = function (err) {
|
||
this.parent._error(err);
|
||
};
|
||
WindowClosingNotifierSubscriber.prototype._complete = function () {
|
||
this.parent._complete();
|
||
};
|
||
return WindowClosingNotifierSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=window.js.map
|
||
},{"../Subject":19,"../Subscriber":20}],115:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subject_1 = require('../Subject');
|
||
function windowCount(windowSize, startWindowEvery) {
|
||
if (startWindowEvery === void 0) { startWindowEvery = 0; }
|
||
return this.lift(new WindowCountOperator(windowSize, startWindowEvery));
|
||
}
|
||
exports.windowCount = windowCount;
|
||
var WindowCountOperator = (function () {
|
||
function WindowCountOperator(windowSize, startWindowEvery) {
|
||
this.windowSize = windowSize;
|
||
this.startWindowEvery = startWindowEvery;
|
||
}
|
||
WindowCountOperator.prototype.call = function (subscriber) {
|
||
return new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery);
|
||
};
|
||
return WindowCountOperator;
|
||
})();
|
||
var WindowCountSubscriber = (function (_super) {
|
||
__extends(WindowCountSubscriber, _super);
|
||
function WindowCountSubscriber(destination, windowSize, startWindowEvery) {
|
||
_super.call(this, destination);
|
||
this.windowSize = windowSize;
|
||
this.startWindowEvery = startWindowEvery;
|
||
this.windows = [new Subject_1.Subject()];
|
||
this.count = 0;
|
||
destination.next(this.windows[0]);
|
||
}
|
||
WindowCountSubscriber.prototype._next = function (value) {
|
||
var startWindowEvery = (this.startWindowEvery > 0) ? this.startWindowEvery : this.windowSize;
|
||
var windowSize = this.windowSize;
|
||
var windows = this.windows;
|
||
var len = windows.length;
|
||
for (var i = 0; i < len; i++) {
|
||
windows[i].next(value);
|
||
}
|
||
var c = this.count - windowSize + 1;
|
||
if (c >= 0 && c % startWindowEvery === 0) {
|
||
windows.shift().complete();
|
||
}
|
||
if (++this.count % startWindowEvery === 0) {
|
||
var window_1 = new Subject_1.Subject();
|
||
windows.push(window_1);
|
||
this.destination.next(window_1);
|
||
}
|
||
};
|
||
WindowCountSubscriber.prototype._error = function (err) {
|
||
var windows = this.windows;
|
||
while (windows.length > 0) {
|
||
windows.shift().error(err);
|
||
}
|
||
this.destination.error(err);
|
||
};
|
||
WindowCountSubscriber.prototype._complete = function () {
|
||
var windows = this.windows;
|
||
while (windows.length > 0) {
|
||
windows.shift().complete();
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
return WindowCountSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=windowCount.js.map
|
||
},{"../Subject":19,"../Subscriber":20}],116:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subject_1 = require('../Subject');
|
||
var nextTick_1 = require('../schedulers/nextTick');
|
||
function windowTime(windowTimeSpan, windowCreationInterval, scheduler) {
|
||
if (windowCreationInterval === void 0) { windowCreationInterval = null; }
|
||
if (scheduler === void 0) { scheduler = nextTick_1.nextTick; }
|
||
return this.lift(new WindowTimeOperator(windowTimeSpan, windowCreationInterval, scheduler));
|
||
}
|
||
exports.windowTime = windowTime;
|
||
var WindowTimeOperator = (function () {
|
||
function WindowTimeOperator(windowTimeSpan, windowCreationInterval, scheduler) {
|
||
this.windowTimeSpan = windowTimeSpan;
|
||
this.windowCreationInterval = windowCreationInterval;
|
||
this.scheduler = scheduler;
|
||
}
|
||
WindowTimeOperator.prototype.call = function (subscriber) {
|
||
return new WindowTimeSubscriber(subscriber, this.windowTimeSpan, this.windowCreationInterval, this.scheduler);
|
||
};
|
||
return WindowTimeOperator;
|
||
})();
|
||
var WindowTimeSubscriber = (function (_super) {
|
||
__extends(WindowTimeSubscriber, _super);
|
||
function WindowTimeSubscriber(destination, windowTimeSpan, windowCreationInterval, scheduler) {
|
||
_super.call(this, destination);
|
||
this.windowTimeSpan = windowTimeSpan;
|
||
this.windowCreationInterval = windowCreationInterval;
|
||
this.scheduler = scheduler;
|
||
this.windows = [];
|
||
if (windowCreationInterval !== null && windowCreationInterval >= 0) {
|
||
var window_1 = this.openWindow();
|
||
var closeState = { subscriber: this, window: window_1, context: null };
|
||
var creationState = { windowTimeSpan: windowTimeSpan, windowCreationInterval: windowCreationInterval, subscriber: this, scheduler: scheduler };
|
||
this.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState));
|
||
this.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState));
|
||
}
|
||
else {
|
||
var window_2 = this.openWindow();
|
||
var timeSpanOnlyState = { subscriber: this, window: window_2, windowTimeSpan: windowTimeSpan };
|
||
this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState));
|
||
}
|
||
}
|
||
WindowTimeSubscriber.prototype._next = function (value) {
|
||
var windows = this.windows;
|
||
var len = windows.length;
|
||
for (var i = 0; i < len; i++) {
|
||
windows[i].next(value);
|
||
}
|
||
};
|
||
WindowTimeSubscriber.prototype._error = function (err) {
|
||
var windows = this.windows;
|
||
while (windows.length > 0) {
|
||
windows.shift().error(err);
|
||
}
|
||
this.destination.error(err);
|
||
};
|
||
WindowTimeSubscriber.prototype._complete = function () {
|
||
var windows = this.windows;
|
||
while (windows.length > 0) {
|
||
windows.shift().complete();
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
WindowTimeSubscriber.prototype.openWindow = function () {
|
||
var window = new Subject_1.Subject();
|
||
this.windows.push(window);
|
||
this.destination.next(window);
|
||
return window;
|
||
};
|
||
WindowTimeSubscriber.prototype.closeWindow = function (window) {
|
||
window.complete();
|
||
var windows = this.windows;
|
||
windows.splice(windows.indexOf(window), 1);
|
||
};
|
||
return WindowTimeSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
function dispatchWindowTimeSpanOnly(state) {
|
||
var subscriber = state.subscriber, windowTimeSpan = state.windowTimeSpan, window = state.window;
|
||
if (window) {
|
||
window.complete();
|
||
}
|
||
state.window = subscriber.openWindow();
|
||
this.schedule(state, windowTimeSpan);
|
||
}
|
||
function dispatchWindowCreation(state) {
|
||
var windowTimeSpan = state.windowTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler, windowCreationInterval = state.windowCreationInterval;
|
||
var window = subscriber.openWindow();
|
||
var action = this;
|
||
var context = { action: action, subscription: null };
|
||
var timeSpanState = { subscriber: subscriber, window: window, context: context };
|
||
context.subscription = scheduler.schedule(dispatchWindowClose, windowTimeSpan, timeSpanState);
|
||
action.add(context.subscription);
|
||
action.schedule(state, windowCreationInterval);
|
||
}
|
||
function dispatchWindowClose(_a) {
|
||
var subscriber = _a.subscriber, window = _a.window, context = _a.context;
|
||
if (context && context.action && context.subscription) {
|
||
context.action.remove(context.subscription);
|
||
}
|
||
subscriber.closeWindow(window);
|
||
}
|
||
//# sourceMappingURL=windowTime.js.map
|
||
},{"../Subject":19,"../Subscriber":20,"../schedulers/nextTick":130}],117:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subject_1 = require('../Subject');
|
||
var Subscription_1 = require('../Subscription');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function windowToggle(openings, closingSelector) {
|
||
return this.lift(new WindowToggleOperator(openings, closingSelector));
|
||
}
|
||
exports.windowToggle = windowToggle;
|
||
var WindowToggleOperator = (function () {
|
||
function WindowToggleOperator(openings, closingSelector) {
|
||
this.openings = openings;
|
||
this.closingSelector = closingSelector;
|
||
}
|
||
WindowToggleOperator.prototype.call = function (subscriber) {
|
||
return new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector);
|
||
};
|
||
return WindowToggleOperator;
|
||
})();
|
||
var WindowToggleSubscriber = (function (_super) {
|
||
__extends(WindowToggleSubscriber, _super);
|
||
function WindowToggleSubscriber(destination, openings, closingSelector) {
|
||
_super.call(this, destination);
|
||
this.openings = openings;
|
||
this.closingSelector = closingSelector;
|
||
this.contexts = [];
|
||
this.add(this.openings._subscribe(new WindowToggleOpeningsSubscriber(this)));
|
||
}
|
||
WindowToggleSubscriber.prototype._next = function (value) {
|
||
var contexts = this.contexts;
|
||
var len = contexts.length;
|
||
for (var i = 0; i < len; i++) {
|
||
contexts[i].window.next(value);
|
||
}
|
||
};
|
||
WindowToggleSubscriber.prototype._error = function (err) {
|
||
var contexts = this.contexts;
|
||
while (contexts.length > 0) {
|
||
contexts.shift().window.error(err);
|
||
}
|
||
this.destination.error(err);
|
||
};
|
||
WindowToggleSubscriber.prototype._complete = function () {
|
||
var contexts = this.contexts;
|
||
while (contexts.length > 0) {
|
||
var context = contexts.shift();
|
||
context.window.complete();
|
||
context.subscription.unsubscribe();
|
||
}
|
||
this.destination.complete();
|
||
};
|
||
WindowToggleSubscriber.prototype.openWindow = function (value) {
|
||
var closingSelector = this.closingSelector;
|
||
var closingNotifier = tryCatch_1.tryCatch(closingSelector)(value);
|
||
if (closingNotifier === errorObject_1.errorObject) {
|
||
this.error(closingNotifier.e);
|
||
}
|
||
else {
|
||
var context = {
|
||
window: new Subject_1.Subject(),
|
||
subscription: new Subscription_1.Subscription()
|
||
};
|
||
this.contexts.push(context);
|
||
this.destination.next(context.window);
|
||
var subscriber = new WindowClosingNotifierSubscriber(this, context);
|
||
var subscription = closingNotifier._subscribe(subscriber);
|
||
this.add(context.subscription.add(subscription));
|
||
}
|
||
};
|
||
WindowToggleSubscriber.prototype.closeWindow = function (context) {
|
||
var window = context.window, subscription = context.subscription;
|
||
var contexts = this.contexts;
|
||
contexts.splice(contexts.indexOf(context), 1);
|
||
window.complete();
|
||
this.remove(subscription);
|
||
subscription.unsubscribe();
|
||
};
|
||
return WindowToggleSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var WindowClosingNotifierSubscriber = (function (_super) {
|
||
__extends(WindowClosingNotifierSubscriber, _super);
|
||
function WindowClosingNotifierSubscriber(parent, windowContext) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
this.windowContext = windowContext;
|
||
}
|
||
WindowClosingNotifierSubscriber.prototype._next = function () {
|
||
this.parent.closeWindow(this.windowContext);
|
||
};
|
||
WindowClosingNotifierSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
WindowClosingNotifierSubscriber.prototype._complete = function () {
|
||
this.parent.closeWindow(this.windowContext);
|
||
};
|
||
return WindowClosingNotifierSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var WindowToggleOpeningsSubscriber = (function (_super) {
|
||
__extends(WindowToggleOpeningsSubscriber, _super);
|
||
function WindowToggleOpeningsSubscriber(parent) {
|
||
_super.call(this);
|
||
this.parent = parent;
|
||
}
|
||
WindowToggleOpeningsSubscriber.prototype._next = function (value) {
|
||
this.parent.openWindow(value);
|
||
};
|
||
WindowToggleOpeningsSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
WindowToggleOpeningsSubscriber.prototype._complete = function () {
|
||
// noop
|
||
};
|
||
return WindowToggleOpeningsSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=windowToggle.js.map
|
||
},{"../Subject":19,"../Subscriber":20,"../Subscription":21,"../util/errorObject":143,"../util/tryCatch":152}],118:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var Subject_1 = require('../Subject');
|
||
var Subscription_1 = require('../Subscription');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
function windowWhen(closingSelector) {
|
||
return this.lift(new WindowOperator(closingSelector));
|
||
}
|
||
exports.windowWhen = windowWhen;
|
||
var WindowOperator = (function () {
|
||
function WindowOperator(closingSelector) {
|
||
this.closingSelector = closingSelector;
|
||
}
|
||
WindowOperator.prototype.call = function (subscriber) {
|
||
return new WindowSubscriber(subscriber, this.closingSelector);
|
||
};
|
||
return WindowOperator;
|
||
})();
|
||
var WindowSubscriber = (function (_super) {
|
||
__extends(WindowSubscriber, _super);
|
||
function WindowSubscriber(destination, closingSelector) {
|
||
_super.call(this, destination);
|
||
this.closingSelector = closingSelector;
|
||
this.window = new Subject_1.Subject();
|
||
this.openWindow();
|
||
}
|
||
WindowSubscriber.prototype._next = function (value) {
|
||
this.window.next(value);
|
||
};
|
||
WindowSubscriber.prototype._error = function (err) {
|
||
this.window.error(err);
|
||
this.destination.error(err);
|
||
this._unsubscribeClosingNotification();
|
||
};
|
||
WindowSubscriber.prototype._complete = function () {
|
||
this.window.complete();
|
||
this.destination.complete();
|
||
this._unsubscribeClosingNotification();
|
||
};
|
||
WindowSubscriber.prototype.unsubscribe = function () {
|
||
_super.prototype.unsubscribe.call(this);
|
||
this._unsubscribeClosingNotification();
|
||
};
|
||
WindowSubscriber.prototype._unsubscribeClosingNotification = function () {
|
||
var closingNotification = this.closingNotification;
|
||
if (closingNotification) {
|
||
closingNotification.unsubscribe();
|
||
}
|
||
};
|
||
WindowSubscriber.prototype.openWindow = function () {
|
||
var prevClosingNotification = this.closingNotification;
|
||
if (prevClosingNotification) {
|
||
this.remove(prevClosingNotification);
|
||
prevClosingNotification.unsubscribe();
|
||
}
|
||
var prevWindow = this.window;
|
||
if (prevWindow) {
|
||
prevWindow.complete();
|
||
}
|
||
this.destination.next(this.window = new Subject_1.Subject());
|
||
var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)();
|
||
if (closingNotifier === errorObject_1.errorObject) {
|
||
var err = closingNotifier.e;
|
||
this.destination.error(err);
|
||
this.window.error(err);
|
||
}
|
||
else {
|
||
var closingNotification = this.closingNotification = new Subscription_1.Subscription();
|
||
this.add(closingNotification.add(closingNotifier._subscribe(new WindowClosingNotifierSubscriber(this))));
|
||
}
|
||
};
|
||
return WindowSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
var WindowClosingNotifierSubscriber = (function (_super) {
|
||
__extends(WindowClosingNotifierSubscriber, _super);
|
||
function WindowClosingNotifierSubscriber(parent) {
|
||
_super.call(this, null);
|
||
this.parent = parent;
|
||
}
|
||
WindowClosingNotifierSubscriber.prototype._next = function () {
|
||
this.parent.openWindow();
|
||
};
|
||
WindowClosingNotifierSubscriber.prototype._error = function (err) {
|
||
this.parent.error(err);
|
||
};
|
||
WindowClosingNotifierSubscriber.prototype._complete = function () {
|
||
this.parent.openWindow();
|
||
};
|
||
return WindowClosingNotifierSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
//# sourceMappingURL=windowWhen.js.map
|
||
},{"../Subject":19,"../Subscriber":20,"../Subscription":21,"../util/errorObject":143,"../util/tryCatch":152}],119:[function(require,module,exports){
|
||
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 tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
/**
|
||
* @param {Observable} observables the observables to get the latest values from.
|
||
* @param {Function} [project] optional projection function for merging values together. Receives all values in order
|
||
* of observables passed. (e.g. `a.withLatestFrom(b, c, (a1, b1, c1) => a1 + b1 + c1)`). If this is not passed, arrays
|
||
* will be returned.
|
||
* @description merges each value from an observable with the latest values from the other passed observables.
|
||
* All observables must emit at least one value before the resulting observable will emit
|
||
*
|
||
* #### example
|
||
* ```
|
||
* A.withLatestFrom(B, C)
|
||
*
|
||
* A: ----a-----------------b---------------c-----------|
|
||
* B: ---d----------------e--------------f---------|
|
||
* C: --x----------------y-------------z-------------|
|
||
* result: ---([a,d,x])---------([b,e,y])--------([c,f,z])---|
|
||
* ```
|
||
*/
|
||
function withLatestFrom() {
|
||
var args = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
args[_i - 0] = arguments[_i];
|
||
}
|
||
var project;
|
||
if (typeof args[args.length - 1] === 'function') {
|
||
project = args.pop();
|
||
}
|
||
var observables = args;
|
||
return this.lift(new WithLatestFromOperator(observables, project));
|
||
}
|
||
exports.withLatestFrom = withLatestFrom;
|
||
var WithLatestFromOperator = (function () {
|
||
function WithLatestFromOperator(observables, project) {
|
||
this.observables = observables;
|
||
this.project = project;
|
||
}
|
||
WithLatestFromOperator.prototype.call = function (subscriber) {
|
||
return new WithLatestFromSubscriber(subscriber, this.observables, this.project);
|
||
};
|
||
return WithLatestFromOperator;
|
||
})();
|
||
var WithLatestFromSubscriber = (function (_super) {
|
||
__extends(WithLatestFromSubscriber, _super);
|
||
function WithLatestFromSubscriber(destination, observables, project) {
|
||
_super.call(this, destination);
|
||
this.observables = observables;
|
||
this.project = project;
|
||
this.toRespond = [];
|
||
var len = observables.length;
|
||
this.values = new Array(len);
|
||
for (var i = 0; i < len; i++) {
|
||
this.toRespond.push(i);
|
||
}
|
||
for (var i = 0; i < len; i++) {
|
||
var observable = observables[i];
|
||
this.add(subscribeToResult_1.subscribeToResult(this, observable, observable, i));
|
||
}
|
||
}
|
||
WithLatestFromSubscriber.prototype.notifyNext = function (observable, value, observableIndex, index) {
|
||
this.values[observableIndex] = value;
|
||
var toRespond = this.toRespond;
|
||
if (toRespond.length > 0) {
|
||
var found = toRespond.indexOf(observableIndex);
|
||
if (found !== -1) {
|
||
toRespond.splice(found, 1);
|
||
}
|
||
}
|
||
};
|
||
WithLatestFromSubscriber.prototype.notifyComplete = function () {
|
||
// noop
|
||
};
|
||
WithLatestFromSubscriber.prototype._next = function (value) {
|
||
if (this.toRespond.length === 0) {
|
||
var values = this.values;
|
||
var destination = this.destination;
|
||
var project = this.project;
|
||
var args = [value].concat(values);
|
||
if (project) {
|
||
var result = tryCatch_1.tryCatch(this.project).apply(this, args);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(result.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(args);
|
||
}
|
||
}
|
||
};
|
||
return WithLatestFromSubscriber;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
//# sourceMappingURL=withLatestFrom.js.map
|
||
},{"../OuterSubscriber":17,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],120:[function(require,module,exports){
|
||
var ArrayObservable_1 = require('../observables/ArrayObservable');
|
||
var zip_support_1 = require('./zip-support');
|
||
function zip() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
var project = observables[observables.length - 1];
|
||
if (typeof project === 'function') {
|
||
observables.pop();
|
||
}
|
||
return new ArrayObservable_1.ArrayObservable(observables).lift(new zip_support_1.ZipOperator(project));
|
||
}
|
||
exports.zip = zip;
|
||
//# sourceMappingURL=zip-static.js.map
|
||
},{"../observables/ArrayObservable":22,"./zip-support":121}],121:[function(require,module,exports){
|
||
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 Subscriber_1 = require('../Subscriber');
|
||
var tryCatch_1 = require('../util/tryCatch');
|
||
var errorObject_1 = require('../util/errorObject');
|
||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||
var Symbol_iterator_1 = require('../util/Symbol_iterator');
|
||
var isArray = Array.isArray;
|
||
var ZipOperator = (function () {
|
||
function ZipOperator(project) {
|
||
this.project = project;
|
||
}
|
||
ZipOperator.prototype.call = function (subscriber) {
|
||
return new ZipSubscriber(subscriber, this.project);
|
||
};
|
||
return ZipOperator;
|
||
})();
|
||
exports.ZipOperator = ZipOperator;
|
||
var ZipSubscriber = (function (_super) {
|
||
__extends(ZipSubscriber, _super);
|
||
function ZipSubscriber(destination, project, values) {
|
||
if (values === void 0) { values = Object.create(null); }
|
||
_super.call(this, destination);
|
||
this.index = 0;
|
||
this.iterators = [];
|
||
this.active = 0;
|
||
this.project = (typeof project === 'function') ? project : null;
|
||
this.values = values;
|
||
}
|
||
ZipSubscriber.prototype._next = function (value) {
|
||
var iterators = this.iterators;
|
||
var index = this.index++;
|
||
if (isArray(value)) {
|
||
iterators.push(new StaticArrayIterator(value));
|
||
}
|
||
else if (typeof value[Symbol_iterator_1.$$iterator] === 'function') {
|
||
iterators.push(new StaticIterator(value[Symbol_iterator_1.$$iterator]()));
|
||
}
|
||
else {
|
||
iterators.push(new ZipBufferIterator(this.destination, this, value, index));
|
||
}
|
||
};
|
||
ZipSubscriber.prototype._complete = function () {
|
||
var iterators = this.iterators;
|
||
var len = iterators.length;
|
||
this.active = len;
|
||
for (var i = 0; i < len; i++) {
|
||
var iterator = iterators[i];
|
||
if (iterator.stillUnsubscribed) {
|
||
iterator.subscribe(iterator, i);
|
||
}
|
||
else {
|
||
this.active--; // not an observable
|
||
}
|
||
}
|
||
};
|
||
ZipSubscriber.prototype.notifyInactive = function () {
|
||
this.active--;
|
||
if (this.active === 0) {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
ZipSubscriber.prototype.checkIterators = function () {
|
||
var iterators = this.iterators;
|
||
var len = iterators.length;
|
||
var destination = this.destination;
|
||
// abort if not all of them have values
|
||
for (var i = 0; i < len; i++) {
|
||
var iterator = iterators[i];
|
||
if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {
|
||
return;
|
||
}
|
||
}
|
||
var shouldComplete = false;
|
||
var args = [];
|
||
for (var i = 0; i < len; i++) {
|
||
var iterator = iterators[i];
|
||
var result = iterator.next();
|
||
// check to see if it's completed now that you've gotten
|
||
// the next value.
|
||
if (iterator.hasCompleted()) {
|
||
shouldComplete = true;
|
||
}
|
||
if (result.done) {
|
||
destination.complete();
|
||
return;
|
||
}
|
||
args.push(result.value);
|
||
}
|
||
var project = this.project;
|
||
if (project) {
|
||
var result = tryCatch_1.tryCatch(project).apply(this, args);
|
||
if (result === errorObject_1.errorObject) {
|
||
destination.error(errorObject_1.errorObject.e);
|
||
}
|
||
else {
|
||
destination.next(result);
|
||
}
|
||
}
|
||
else {
|
||
destination.next(args);
|
||
}
|
||
if (shouldComplete) {
|
||
destination.complete();
|
||
}
|
||
};
|
||
return ZipSubscriber;
|
||
})(Subscriber_1.Subscriber);
|
||
exports.ZipSubscriber = ZipSubscriber;
|
||
var StaticIterator = (function () {
|
||
function StaticIterator(iterator) {
|
||
this.iterator = iterator;
|
||
this.nextResult = iterator.next();
|
||
}
|
||
StaticIterator.prototype.hasValue = function () {
|
||
return true;
|
||
};
|
||
StaticIterator.prototype.next = function () {
|
||
var result = this.nextResult;
|
||
this.nextResult = this.iterator.next();
|
||
return result;
|
||
};
|
||
StaticIterator.prototype.hasCompleted = function () {
|
||
var nextResult = this.nextResult;
|
||
return nextResult && nextResult.done;
|
||
};
|
||
return StaticIterator;
|
||
})();
|
||
var StaticArrayIterator = (function () {
|
||
function StaticArrayIterator(array) {
|
||
this.array = array;
|
||
this.index = 0;
|
||
this.length = 0;
|
||
this.length = array.length;
|
||
}
|
||
StaticArrayIterator.prototype[Symbol_iterator_1.$$iterator] = function () {
|
||
return this;
|
||
};
|
||
StaticArrayIterator.prototype.next = function (value) {
|
||
var i = this.index++;
|
||
var array = this.array;
|
||
return i < this.length ? { value: array[i], done: false } : { done: true };
|
||
};
|
||
StaticArrayIterator.prototype.hasValue = function () {
|
||
return this.array.length > this.index;
|
||
};
|
||
StaticArrayIterator.prototype.hasCompleted = function () {
|
||
return this.array.length === this.index;
|
||
};
|
||
return StaticArrayIterator;
|
||
})();
|
||
var ZipBufferIterator = (function (_super) {
|
||
__extends(ZipBufferIterator, _super);
|
||
function ZipBufferIterator(destination, parent, observable, index) {
|
||
_super.call(this, destination);
|
||
this.parent = parent;
|
||
this.observable = observable;
|
||
this.index = index;
|
||
this.stillUnsubscribed = true;
|
||
this.buffer = [];
|
||
this.isComplete = false;
|
||
}
|
||
ZipBufferIterator.prototype[Symbol_iterator_1.$$iterator] = function () {
|
||
return this;
|
||
};
|
||
// NOTE: there is actually a name collision here with Subscriber.next and Iterator.next
|
||
// this is legit because `next()` will never be called by a subscription in this case.
|
||
ZipBufferIterator.prototype.next = function () {
|
||
var buffer = this.buffer;
|
||
if (buffer.length === 0 && this.isComplete) {
|
||
return { done: true };
|
||
}
|
||
else {
|
||
return { value: buffer.shift(), done: false };
|
||
}
|
||
};
|
||
ZipBufferIterator.prototype.hasValue = function () {
|
||
return this.buffer.length > 0;
|
||
};
|
||
ZipBufferIterator.prototype.hasCompleted = function () {
|
||
return this.buffer.length === 0 && this.isComplete;
|
||
};
|
||
ZipBufferIterator.prototype.notifyComplete = function () {
|
||
if (this.buffer.length > 0) {
|
||
this.isComplete = true;
|
||
this.parent.notifyInactive();
|
||
}
|
||
else {
|
||
this.destination.complete();
|
||
}
|
||
};
|
||
ZipBufferIterator.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||
this.buffer.push(innerValue);
|
||
this.parent.checkIterators();
|
||
};
|
||
ZipBufferIterator.prototype.subscribe = function (value, index) {
|
||
this.add(subscribeToResult_1.subscribeToResult(this, this.observable, this, index));
|
||
};
|
||
return ZipBufferIterator;
|
||
})(OuterSubscriber_1.OuterSubscriber);
|
||
//# sourceMappingURL=zip-support.js.map
|
||
},{"../OuterSubscriber":17,"../Subscriber":20,"../util/Symbol_iterator":140,"../util/errorObject":143,"../util/subscribeToResult":150,"../util/tryCatch":152}],122:[function(require,module,exports){
|
||
var zip_static_1 = require('./zip-static');
|
||
function zipProto() {
|
||
var observables = [];
|
||
for (var _i = 0; _i < arguments.length; _i++) {
|
||
observables[_i - 0] = arguments[_i];
|
||
}
|
||
observables.unshift(this);
|
||
return zip_static_1.zip.apply(this, observables);
|
||
}
|
||
exports.zipProto = zipProto;
|
||
//# sourceMappingURL=zip.js.map
|
||
},{"./zip-static":120}],123:[function(require,module,exports){
|
||
var zip_support_1 = require('./zip-support');
|
||
function zipAll(project) {
|
||
return this.lift(new zip_support_1.ZipOperator(project));
|
||
}
|
||
exports.zipAll = zipAll;
|
||
//# sourceMappingURL=zipAll.js.map
|
||
},{"./zip-support":121}],124:[function(require,module,exports){
|
||
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 ImmediateAction_1 = require('./ImmediateAction');
|
||
var FutureAction = (function (_super) {
|
||
__extends(FutureAction, _super);
|
||
function FutureAction(scheduler, work) {
|
||
_super.call(this, scheduler, work);
|
||
this.scheduler = scheduler;
|
||
this.work = work;
|
||
}
|
||
FutureAction.prototype.schedule = function (state, delay) {
|
||
var _this = this;
|
||
if (delay === void 0) { delay = 0; }
|
||
if (this.isUnsubscribed) {
|
||
return this;
|
||
}
|
||
this.delay = delay;
|
||
this.state = state;
|
||
var id = this.id;
|
||
if (id != null) {
|
||
this.id = undefined;
|
||
clearTimeout(id);
|
||
}
|
||
var scheduler = this.scheduler;
|
||
this.id = setTimeout(function () {
|
||
_this.id = void 0;
|
||
scheduler.actions.push(_this);
|
||
scheduler.flush();
|
||
}, this.delay);
|
||
return this;
|
||
};
|
||
FutureAction.prototype.unsubscribe = function () {
|
||
var id = this.id;
|
||
if (id != null) {
|
||
this.id = void 0;
|
||
clearTimeout(id);
|
||
}
|
||
_super.prototype.unsubscribe.call(this);
|
||
};
|
||
return FutureAction;
|
||
})(ImmediateAction_1.ImmediateAction);
|
||
exports.FutureAction = FutureAction;
|
||
//# sourceMappingURL=FutureAction.js.map
|
||
},{"./ImmediateAction":125}],125:[function(require,module,exports){
|
||
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 Subscription_1 = require('../Subscription');
|
||
var ImmediateAction = (function (_super) {
|
||
__extends(ImmediateAction, _super);
|
||
function ImmediateAction(scheduler, work) {
|
||
_super.call(this);
|
||
this.scheduler = scheduler;
|
||
this.work = work;
|
||
}
|
||
ImmediateAction.prototype.schedule = function (state) {
|
||
if (this.isUnsubscribed) {
|
||
return this;
|
||
}
|
||
this.state = state;
|
||
var scheduler = this.scheduler;
|
||
scheduler.actions.push(this);
|
||
scheduler.flush();
|
||
return this;
|
||
};
|
||
ImmediateAction.prototype.execute = function () {
|
||
if (this.isUnsubscribed) {
|
||
throw new Error('How did did we execute a canceled Action?');
|
||
}
|
||
this.work(this.state);
|
||
};
|
||
ImmediateAction.prototype.unsubscribe = function () {
|
||
var scheduler = this.scheduler;
|
||
var actions = scheduler.actions;
|
||
var index = actions.indexOf(this);
|
||
this.work = void 0;
|
||
this.state = void 0;
|
||
this.scheduler = void 0;
|
||
if (index !== -1) {
|
||
actions.splice(index, 1);
|
||
}
|
||
_super.prototype.unsubscribe.call(this);
|
||
};
|
||
return ImmediateAction;
|
||
})(Subscription_1.Subscription);
|
||
exports.ImmediateAction = ImmediateAction;
|
||
//# sourceMappingURL=ImmediateAction.js.map
|
||
},{"../Subscription":21}],126:[function(require,module,exports){
|
||
var ImmediateAction_1 = require('./ImmediateAction');
|
||
var FutureAction_1 = require('./FutureAction');
|
||
var ImmediateScheduler = (function () {
|
||
function ImmediateScheduler() {
|
||
this.actions = [];
|
||
this.active = false;
|
||
this.scheduled = false;
|
||
}
|
||
ImmediateScheduler.prototype.now = function () {
|
||
return Date.now();
|
||
};
|
||
ImmediateScheduler.prototype.flush = function () {
|
||
if (this.active || this.scheduled) {
|
||
return;
|
||
}
|
||
this.active = true;
|
||
var actions = this.actions;
|
||
for (var action = void 0; action = actions.shift();) {
|
||
action.execute();
|
||
}
|
||
this.active = false;
|
||
};
|
||
ImmediateScheduler.prototype.schedule = function (work, delay, state) {
|
||
if (delay === void 0) { delay = 0; }
|
||
return (delay <= 0) ?
|
||
this.scheduleNow(work, state) :
|
||
this.scheduleLater(work, delay, state);
|
||
};
|
||
ImmediateScheduler.prototype.scheduleNow = function (work, state) {
|
||
return new ImmediateAction_1.ImmediateAction(this, work).schedule(state);
|
||
};
|
||
ImmediateScheduler.prototype.scheduleLater = function (work, delay, state) {
|
||
return new FutureAction_1.FutureAction(this, work).schedule(state, delay);
|
||
};
|
||
return ImmediateScheduler;
|
||
})();
|
||
exports.ImmediateScheduler = ImmediateScheduler;
|
||
//# sourceMappingURL=ImmediateScheduler.js.map
|
||
},{"./FutureAction":124,"./ImmediateAction":125}],127:[function(require,module,exports){
|
||
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 Immediate_1 = require('../util/Immediate');
|
||
var ImmediateAction_1 = require('./ImmediateAction');
|
||
var NextTickAction = (function (_super) {
|
||
__extends(NextTickAction, _super);
|
||
function NextTickAction() {
|
||
_super.apply(this, arguments);
|
||
}
|
||
NextTickAction.prototype.schedule = function (state) {
|
||
var _this = this;
|
||
if (this.isUnsubscribed) {
|
||
return this;
|
||
}
|
||
this.state = state;
|
||
var scheduler = this.scheduler;
|
||
scheduler.actions.push(this);
|
||
if (!scheduler.scheduled) {
|
||
scheduler.scheduled = true;
|
||
this.id = Immediate_1.Immediate.setImmediate(function () {
|
||
_this.id = null;
|
||
_this.scheduler.scheduled = false;
|
||
_this.scheduler.flush();
|
||
});
|
||
}
|
||
return this;
|
||
};
|
||
NextTickAction.prototype.unsubscribe = function () {
|
||
var id = this.id;
|
||
var scheduler = this.scheduler;
|
||
_super.prototype.unsubscribe.call(this);
|
||
if (scheduler.actions.length === 0) {
|
||
scheduler.active = false;
|
||
scheduler.scheduled = false;
|
||
}
|
||
if (id) {
|
||
this.id = null;
|
||
Immediate_1.Immediate.clearImmediate(id);
|
||
}
|
||
};
|
||
return NextTickAction;
|
||
})(ImmediateAction_1.ImmediateAction);
|
||
exports.NextTickAction = NextTickAction;
|
||
//# sourceMappingURL=NextTickAction.js.map
|
||
},{"../util/Immediate":137,"./ImmediateAction":125}],128:[function(require,module,exports){
|
||
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 ImmediateScheduler_1 = require('./ImmediateScheduler');
|
||
var NextTickAction_1 = require('./NextTickAction');
|
||
var ImmediateAction_1 = require('./ImmediateAction');
|
||
var NextTickScheduler = (function (_super) {
|
||
__extends(NextTickScheduler, _super);
|
||
function NextTickScheduler() {
|
||
_super.apply(this, arguments);
|
||
}
|
||
NextTickScheduler.prototype.scheduleNow = function (work, state) {
|
||
return (this.scheduled ?
|
||
new ImmediateAction_1.ImmediateAction(this, work) :
|
||
new NextTickAction_1.NextTickAction(this, work)).schedule(state);
|
||
};
|
||
return NextTickScheduler;
|
||
})(ImmediateScheduler_1.ImmediateScheduler);
|
||
exports.NextTickScheduler = NextTickScheduler;
|
||
//# sourceMappingURL=NextTickScheduler.js.map
|
||
},{"./ImmediateAction":125,"./ImmediateScheduler":126,"./NextTickAction":127}],129:[function(require,module,exports){
|
||
var ImmediateScheduler_1 = require('./ImmediateScheduler');
|
||
exports.immediate = new ImmediateScheduler_1.ImmediateScheduler();
|
||
//# sourceMappingURL=immediate.js.map
|
||
},{"./ImmediateScheduler":126}],130:[function(require,module,exports){
|
||
var NextTickScheduler_1 = require('./NextTickScheduler');
|
||
exports.nextTick = new NextTickScheduler_1.NextTickScheduler();
|
||
//# sourceMappingURL=nextTick.js.map
|
||
},{"./NextTickScheduler":128}],131:[function(require,module,exports){
|
||
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 BehaviorSubject = (function (_super) {
|
||
__extends(BehaviorSubject, _super);
|
||
function BehaviorSubject(value) {
|
||
_super.call(this);
|
||
this.value = value;
|
||
}
|
||
BehaviorSubject.prototype._subscribe = function (subscriber) {
|
||
var subscription = _super.prototype._subscribe.call(this, subscriber);
|
||
if (!subscription) {
|
||
return;
|
||
}
|
||
else if (!subscription.isUnsubscribed) {
|
||
subscriber.next(this.value);
|
||
}
|
||
return subscription;
|
||
};
|
||
BehaviorSubject.prototype._next = function (value) {
|
||
_super.prototype._next.call(this, this.value = value);
|
||
};
|
||
return BehaviorSubject;
|
||
})(Subject_1.Subject);
|
||
exports.BehaviorSubject = BehaviorSubject;
|
||
//# sourceMappingURL=BehaviorSubject.js.map
|
||
},{"../Subject":19}],132:[function(require,module,exports){
|
||
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 immediate_1 = require('../schedulers/immediate');
|
||
var ReplaySubject = (function (_super) {
|
||
__extends(ReplaySubject, _super);
|
||
function ReplaySubject(bufferSize, windowTime, scheduler) {
|
||
if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; }
|
||
if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; }
|
||
_super.call(this);
|
||
this.events = [];
|
||
this.bufferSize = bufferSize < 1 ? 1 : bufferSize;
|
||
this._windowTime = windowTime < 1 ? 1 : windowTime;
|
||
this.scheduler = scheduler;
|
||
}
|
||
ReplaySubject.prototype._next = function (value) {
|
||
var now = this._getNow();
|
||
this.events.push(new ReplayEvent(now, value));
|
||
_super.prototype._next.call(this, value);
|
||
};
|
||
ReplaySubject.prototype._subscribe = function (subscriber) {
|
||
var events = this._getEvents(this._getNow());
|
||
var index = -1;
|
||
var len = events.length;
|
||
while (!subscriber.isUnsubscribed && ++index < len) {
|
||
subscriber.next(events[index].value);
|
||
}
|
||
return _super.prototype._subscribe.call(this, subscriber);
|
||
};
|
||
ReplaySubject.prototype._getNow = function () {
|
||
return (this.scheduler || immediate_1.immediate).now();
|
||
};
|
||
ReplaySubject.prototype._getEvents = function (now) {
|
||
var bufferSize = this.bufferSize;
|
||
var _windowTime = this._windowTime;
|
||
var events = this.events;
|
||
var eventsCount = events.length;
|
||
var spliceCount = 0;
|
||
// Trim events that fall out of the time window.
|
||
// Start at the front of the list. Break early once
|
||
// we encounter an event that falls within the window.
|
||
while (spliceCount < eventsCount) {
|
||
if ((now - events[spliceCount].time) < _windowTime) {
|
||
break;
|
||
}
|
||
spliceCount += 1;
|
||
}
|
||
if (eventsCount > bufferSize) {
|
||
spliceCount = Math.max(spliceCount, eventsCount - bufferSize);
|
||
}
|
||
if (spliceCount > 0) {
|
||
events.splice(0, spliceCount);
|
||
}
|
||
return events;
|
||
};
|
||
return ReplaySubject;
|
||
})(Subject_1.Subject);
|
||
exports.ReplaySubject = ReplaySubject;
|
||
var ReplayEvent = (function () {
|
||
function ReplayEvent(time, value) {
|
||
this.time = time;
|
||
this.value = value;
|
||
}
|
||
return ReplayEvent;
|
||
})();
|
||
//# sourceMappingURL=ReplaySubject.js.map
|
||
},{"../Subject":19,"../schedulers/immediate":129}],133:[function(require,module,exports){
|
||
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 Subscription_1 = require('../Subscription');
|
||
var Subscriber_1 = require('../Subscriber');
|
||
var SubjectSubscription = (function (_super) {
|
||
__extends(SubjectSubscription, _super);
|
||
function SubjectSubscription(subject, observer) {
|
||
_super.call(this);
|
||
this.subject = subject;
|
||
this.observer = observer;
|
||
this.isUnsubscribed = false;
|
||
}
|
||
SubjectSubscription.prototype.unsubscribe = function () {
|
||
if (this.isUnsubscribed) {
|
||
return;
|
||
}
|
||
this.isUnsubscribed = true;
|
||
var subject = this.subject;
|
||
var observers = subject.observers;
|
||
this.subject = void 0;
|
||
if (!observers || observers.length === 0 || subject.isUnsubscribed) {
|
||
return;
|
||
}
|
||
if (this.observer instanceof Subscriber_1.Subscriber) {
|
||
this.observer.unsubscribe();
|
||
}
|
||
var subscriberIndex = observers.indexOf(this.observer);
|
||
if (subscriberIndex !== -1) {
|
||
observers.splice(subscriberIndex, 1);
|
||
}
|
||
};
|
||
return SubjectSubscription;
|
||
})(Subscription_1.Subscription);
|
||
exports.SubjectSubscription = SubjectSubscription;
|
||
//# sourceMappingURL=SubjectSubscription.js.map
|
||
},{"../Subscriber":20,"../Subscription":21}],134:[function(require,module,exports){
|
||
var ArgumentOutOfRangeError = (function () {
|
||
function ArgumentOutOfRangeError() {
|
||
this.name = 'ArgumentOutOfRangeError';
|
||
this.message = 'argument out of range';
|
||
}
|
||
return ArgumentOutOfRangeError;
|
||
})();
|
||
exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError;
|
||
//# sourceMappingURL=ArgumentOutOfRangeError.js.map
|
||
},{}],135:[function(require,module,exports){
|
||
var EmptyError = (function () {
|
||
function EmptyError() {
|
||
this.name = 'EmptyError';
|
||
this.message = 'no elements in sequence';
|
||
}
|
||
return EmptyError;
|
||
})();
|
||
exports.EmptyError = EmptyError;
|
||
//# sourceMappingURL=EmptyError.js.map
|
||
},{}],136:[function(require,module,exports){
|
||
var FastMap = (function () {
|
||
function FastMap() {
|
||
this.size = 0;
|
||
this._values = {};
|
||
}
|
||
FastMap.prototype.delete = function (key) {
|
||
this._values[key] = null;
|
||
return true;
|
||
};
|
||
FastMap.prototype.set = function (key, value) {
|
||
this._values[key] = value;
|
||
return this;
|
||
};
|
||
FastMap.prototype.get = function (key) {
|
||
return this._values[key];
|
||
};
|
||
FastMap.prototype.forEach = function (cb, thisArg) {
|
||
var values = this._values;
|
||
for (var key in values) {
|
||
if (values.hasOwnProperty(key) && values[key] !== null) {
|
||
cb.call(thisArg, values[key], key);
|
||
}
|
||
}
|
||
};
|
||
FastMap.prototype.clear = function () {
|
||
this._values = {};
|
||
};
|
||
return FastMap;
|
||
})();
|
||
exports.FastMap = FastMap;
|
||
//# sourceMappingURL=FastMap.js.map
|
||
},{}],137:[function(require,module,exports){
|
||
/**
|
||
Some credit for this helper goes to http://github.com/YuzuJS/setImmediate
|
||
*/
|
||
var root_1 = require('./root');
|
||
var ImmediateDefinition = (function () {
|
||
function ImmediateDefinition(root) {
|
||
this.root = root;
|
||
if (root.setImmediate) {
|
||
this.setImmediate = root.setImmediate;
|
||
this.clearImmediate = root.clearImmediate;
|
||
}
|
||
else {
|
||
this.nextHandle = 1;
|
||
this.tasksByHandle = {};
|
||
this.currentlyRunningATask = false;
|
||
// Don't get fooled by e.g. browserify environments.
|
||
if (this.canUseProcessNextTick()) {
|
||
// For Node.js before 0.9
|
||
this.setImmediate = this.createProcessNextTickSetImmediate();
|
||
}
|
||
else if (this.canUsePostMessage()) {
|
||
// For non-IE10 modern browsers
|
||
this.setImmediate = this.createPostMessageSetImmediate();
|
||
}
|
||
else if (this.canUseMessageChannel()) {
|
||
// For web workers, where supported
|
||
this.setImmediate = this.createMessageChannelSetImmediate();
|
||
}
|
||
else if (this.canUseReadyStateChange()) {
|
||
// For IE 6–8
|
||
this.setImmediate = this.createReadyStateChangeSetImmediate();
|
||
}
|
||
else {
|
||
// For older browsers
|
||
this.setImmediate = this.createSetTimeoutSetImmediate();
|
||
}
|
||
var ci = function clearImmediate(handle) {
|
||
delete clearImmediate.instance.tasksByHandle[handle];
|
||
};
|
||
ci.instance = this;
|
||
this.clearImmediate = ci;
|
||
}
|
||
}
|
||
ImmediateDefinition.prototype.identify = function (o) {
|
||
return this.root.Object.prototype.toString.call(o);
|
||
};
|
||
ImmediateDefinition.prototype.canUseProcessNextTick = function () {
|
||
return this.identify(this.root.process) === '[object process]';
|
||
};
|
||
ImmediateDefinition.prototype.canUseMessageChannel = function () {
|
||
return Boolean(this.root.MessageChannel);
|
||
};
|
||
ImmediateDefinition.prototype.canUseReadyStateChange = function () {
|
||
var document = this.root.document;
|
||
return Boolean(document && 'onreadystatechange' in document.createElement('script'));
|
||
};
|
||
ImmediateDefinition.prototype.canUsePostMessage = function () {
|
||
var root = this.root;
|
||
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
|
||
// where `root.postMessage` means something completely different and can't be used for this purpose.
|
||
if (root.postMessage && !root.importScripts) {
|
||
var postMessageIsAsynchronous = true;
|
||
var oldOnMessage = root.onmessage;
|
||
root.onmessage = function () {
|
||
postMessageIsAsynchronous = false;
|
||
};
|
||
root.postMessage('', '*');
|
||
root.onmessage = oldOnMessage;
|
||
return postMessageIsAsynchronous;
|
||
}
|
||
return false;
|
||
};
|
||
// This function accepts the same arguments as setImmediate, but
|
||
// returns a function that requires no arguments.
|
||
ImmediateDefinition.prototype.partiallyApplied = function (handler) {
|
||
var args = [];
|
||
for (var _i = 1; _i < arguments.length; _i++) {
|
||
args[_i - 1] = arguments[_i];
|
||
}
|
||
var fn = function result() {
|
||
var _a = result, handler = _a.handler, args = _a.args;
|
||
if (typeof handler === 'function') {
|
||
handler.apply(undefined, args);
|
||
}
|
||
else {
|
||
(new Function('' + handler))();
|
||
}
|
||
};
|
||
fn.handler = handler;
|
||
fn.args = args;
|
||
return fn;
|
||
};
|
||
ImmediateDefinition.prototype.addFromSetImmediateArguments = function (args) {
|
||
this.tasksByHandle[this.nextHandle] = this.partiallyApplied.apply(undefined, args);
|
||
return this.nextHandle++;
|
||
};
|
||
ImmediateDefinition.prototype.createProcessNextTickSetImmediate = function () {
|
||
var fn = function setImmediate() {
|
||
var instance = setImmediate.instance;
|
||
var handle = instance.addFromSetImmediateArguments(arguments);
|
||
instance.root.process.nextTick(instance.partiallyApplied(instance.runIfPresent, handle));
|
||
return handle;
|
||
};
|
||
fn.instance = this;
|
||
return fn;
|
||
};
|
||
ImmediateDefinition.prototype.createPostMessageSetImmediate = function () {
|
||
// Installs an event handler on `global` for the `message` event: see
|
||
// * https://developer.mozilla.org/en/DOM/window.postMessage
|
||
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
|
||
var root = this.root;
|
||
var messagePrefix = 'setImmediate$' + root.Math.random() + '$';
|
||
var onGlobalMessage = function globalMessageHandler(event) {
|
||
var instance = globalMessageHandler.instance;
|
||
if (event.source === root &&
|
||
typeof event.data === 'string' &&
|
||
event.data.indexOf(messagePrefix) === 0) {
|
||
instance.runIfPresent(+event.data.slice(messagePrefix.length));
|
||
}
|
||
};
|
||
onGlobalMessage.instance = this;
|
||
root.addEventListener('message', onGlobalMessage, false);
|
||
var fn = function setImmediate() {
|
||
var _a = setImmediate, messagePrefix = _a.messagePrefix, instance = _a.instance;
|
||
var handle = instance.addFromSetImmediateArguments(arguments);
|
||
instance.root.postMessage(messagePrefix + handle, '*');
|
||
return handle;
|
||
};
|
||
fn.instance = this;
|
||
fn.messagePrefix = messagePrefix;
|
||
return fn;
|
||
};
|
||
ImmediateDefinition.prototype.runIfPresent = function (handle) {
|
||
// From the spec: 'Wait until any invocations of this algorithm started before this one have completed.'
|
||
// So if we're currently running a task, we'll need to delay this invocation.
|
||
if (this.currentlyRunningATask) {
|
||
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
|
||
// 'too much recursion' error.
|
||
this.root.setTimeout(this.partiallyApplied(this.runIfPresent, handle), 0);
|
||
}
|
||
else {
|
||
var task = this.tasksByHandle[handle];
|
||
if (task) {
|
||
this.currentlyRunningATask = true;
|
||
try {
|
||
task();
|
||
}
|
||
finally {
|
||
this.clearImmediate(handle);
|
||
this.currentlyRunningATask = false;
|
||
}
|
||
}
|
||
}
|
||
};
|
||
ImmediateDefinition.prototype.createMessageChannelSetImmediate = function () {
|
||
var _this = this;
|
||
var channel = new this.root.MessageChannel();
|
||
channel.port1.onmessage = function (event) {
|
||
var handle = event.data;
|
||
_this.runIfPresent(handle);
|
||
};
|
||
var fn = function setImmediate() {
|
||
var _a = setImmediate, channel = _a.channel, instance = _a.instance;
|
||
var handle = instance.addFromSetImmediateArguments(arguments);
|
||
channel.port2.postMessage(handle);
|
||
return handle;
|
||
};
|
||
fn.channel = channel;
|
||
fn.instance = this;
|
||
return fn;
|
||
};
|
||
ImmediateDefinition.prototype.createReadyStateChangeSetImmediate = function () {
|
||
var fn = function setImmediate() {
|
||
var instance = setImmediate.instance;
|
||
var root = instance.root;
|
||
var doc = root.document;
|
||
var html = doc.documentElement;
|
||
var handle = instance.addFromSetImmediateArguments(arguments);
|
||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||
var script = doc.createElement('script');
|
||
script.onreadystatechange = function () {
|
||
instance.runIfPresent(handle);
|
||
script.onreadystatechange = null;
|
||
html.removeChild(script);
|
||
script = null;
|
||
};
|
||
html.appendChild(script);
|
||
return handle;
|
||
};
|
||
fn.instance = this;
|
||
return fn;
|
||
};
|
||
ImmediateDefinition.prototype.createSetTimeoutSetImmediate = function () {
|
||
var fn = function setImmediate() {
|
||
var instance = setImmediate.instance;
|
||
var handle = instance.addFromSetImmediateArguments(arguments);
|
||
instance.root.setTimeout(instance.partiallyApplied(instance.runIfPresent, handle), 0);
|
||
return handle;
|
||
};
|
||
fn.instance = this;
|
||
return fn;
|
||
};
|
||
return ImmediateDefinition;
|
||
})();
|
||
exports.ImmediateDefinition = ImmediateDefinition;
|
||
exports.Immediate = new ImmediateDefinition(root_1.root);
|
||
//# sourceMappingURL=Immediate.js.map
|
||
},{"./root":149}],138:[function(require,module,exports){
|
||
var root_1 = require('./root');
|
||
var MapPolyfill_1 = require('./MapPolyfill');
|
||
exports.Map = root_1.root.Map || (function () { return MapPolyfill_1.MapPolyfill; })();
|
||
//# sourceMappingURL=Map.js.map
|
||
},{"./MapPolyfill":139,"./root":149}],139:[function(require,module,exports){
|
||
var MapPolyfill = (function () {
|
||
function MapPolyfill() {
|
||
this.size = 0;
|
||
this._values = [];
|
||
this._keys = [];
|
||
}
|
||
MapPolyfill.prototype.get = function (key) {
|
||
var i = this._keys.indexOf(key);
|
||
return i === -1 ? undefined : this._values[i];
|
||
};
|
||
MapPolyfill.prototype.set = function (key, value) {
|
||
var i = this._keys.indexOf(key);
|
||
if (i === -1) {
|
||
this._keys.push(key);
|
||
this._values.push(value);
|
||
this.size++;
|
||
}
|
||
else {
|
||
this._values[i] = value;
|
||
}
|
||
return this;
|
||
};
|
||
MapPolyfill.prototype.delete = function (key) {
|
||
var i = this._keys.indexOf(key);
|
||
if (i === -1) {
|
||
return false;
|
||
}
|
||
this._values.splice(i, 1);
|
||
this._keys.splice(i, 1);
|
||
this.size--;
|
||
return true;
|
||
};
|
||
MapPolyfill.prototype.forEach = function (cb, thisArg) {
|
||
for (var i = 0; i < this.size; i++) {
|
||
cb.call(thisArg, this._values[i], this._keys[i]);
|
||
}
|
||
};
|
||
return MapPolyfill;
|
||
})();
|
||
exports.MapPolyfill = MapPolyfill;
|
||
//# sourceMappingURL=MapPolyfill.js.map
|
||
},{}],140:[function(require,module,exports){
|
||
var root_1 = require('./root');
|
||
if (!root_1.root.Symbol) {
|
||
root_1.root.Symbol = {};
|
||
}
|
||
if (!root_1.root.Symbol.iterator) {
|
||
if (typeof root_1.root.Symbol.for === 'function') {
|
||
root_1.root.Symbol.iterator = root_1.root.Symbol.for('iterator');
|
||
}
|
||
else if (root_1.root.Set && typeof new root_1.root.Set()['@@iterator'] === 'function') {
|
||
// Bug for mozilla version
|
||
root_1.root.Symbol.iterator = '@@iterator';
|
||
}
|
||
else if (root_1.root.Map) {
|
||
// es6-shim specific logic
|
||
var keys = Object.getOwnPropertyNames(root_1.root.Map.prototype);
|
||
for (var i = 0; i < keys.length; ++i) {
|
||
var key = keys[i];
|
||
if (key !== 'entries' && key !== 'size' && root_1.root.Map.prototype[key] === root_1.root.Map.prototype['entries']) {
|
||
root_1.root.Symbol.iterator = key;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
root_1.root.Symbol.iterator = '@@iterator';
|
||
}
|
||
}
|
||
exports.$$iterator = root_1.root.Symbol.iterator;
|
||
// // Shim in iterator support
|
||
// export var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_';
|
||
// // Bug for mozilla version
|
||
// if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
|
||
// $iterator$ = '@@iterator';
|
||
// }
|
||
//# sourceMappingURL=Symbol_iterator.js.map
|
||
},{"./root":149}],141:[function(require,module,exports){
|
||
var root_1 = require('./root');
|
||
if (!root_1.root.Symbol) {
|
||
root_1.root.Symbol = {};
|
||
}
|
||
if (!root_1.root.Symbol.observable) {
|
||
if (typeof root_1.root.Symbol.for === 'function') {
|
||
root_1.root.Symbol.observable = root_1.root.Symbol.for('observable');
|
||
}
|
||
else {
|
||
root_1.root.Symbol.observable = '@@observable';
|
||
}
|
||
}
|
||
exports.$$observable = root_1.root.Symbol.observable;
|
||
//# sourceMappingURL=Symbol_observable.js.map
|
||
},{"./root":149}],142:[function(require,module,exports){
|
||
function bindCallback(func, thisArg, argCount) {
|
||
if (typeof thisArg === 'undefined') {
|
||
return func;
|
||
}
|
||
switch (argCount) {
|
||
case 0:
|
||
return function () {
|
||
return func.call(thisArg);
|
||
};
|
||
case 1:
|
||
return function (arg) {
|
||
return func.call(thisArg, arg);
|
||
};
|
||
case 2:
|
||
return function (value, index) {
|
||
return func.call(thisArg, value, index);
|
||
};
|
||
case 3:
|
||
return function (value, index, collection) {
|
||
return func.call(thisArg, value, index, collection);
|
||
};
|
||
}
|
||
return function () {
|
||
return func.apply(thisArg, arguments);
|
||
};
|
||
}
|
||
exports.bindCallback = bindCallback;
|
||
;
|
||
//# sourceMappingURL=bindCallback.js.map
|
||
},{}],143:[function(require,module,exports){
|
||
exports.errorObject = { e: {} };
|
||
//# sourceMappingURL=errorObject.js.map
|
||
},{}],144:[function(require,module,exports){
|
||
function isDate(value) {
|
||
return value instanceof Date && !isNaN(+value);
|
||
}
|
||
exports.isDate = isDate;
|
||
//# sourceMappingURL=isDate.js.map
|
||
},{}],145:[function(require,module,exports){
|
||
var is_array = Array.isArray;
|
||
function isNumeric(val) {
|
||
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
|
||
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
|
||
// subtraction forces infinities to NaN
|
||
// adding 1 corrects loss of precision from parseFloat (#15100)
|
||
return !is_array(val) && (val - parseFloat(val) + 1) >= 0;
|
||
}
|
||
exports.isNumeric = isNumeric;
|
||
;
|
||
//# sourceMappingURL=isNumeric.js.map
|
||
},{}],146:[function(require,module,exports){
|
||
function isPromise(value) {
|
||
return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
|
||
}
|
||
exports.isPromise = isPromise;
|
||
//# sourceMappingURL=isPromise.js.map
|
||
},{}],147:[function(require,module,exports){
|
||
/* tslint:disable:no-empty */
|
||
function noop() { }
|
||
exports.noop = noop;
|
||
//# sourceMappingURL=noop.js.map
|
||
},{}],148:[function(require,module,exports){
|
||
function not(pred, thisArg) {
|
||
function notPred() {
|
||
return !(notPred.pred.apply(notPred.thisArg, arguments));
|
||
}
|
||
notPred.pred = pred;
|
||
notPred.thisArg = thisArg;
|
||
return notPred;
|
||
}
|
||
exports.not = not;
|
||
//# sourceMappingURL=not.js.map
|
||
},{}],149:[function(require,module,exports){
|
||
(function (global){
|
||
var objectTypes = {
|
||
'boolean': false,
|
||
'function': true,
|
||
'object': true,
|
||
'number': false,
|
||
'string': false,
|
||
'undefined': false
|
||
};
|
||
exports.root = (objectTypes[typeof self] && self) || (objectTypes[typeof window] && window);
|
||
/* tslint:disable:no-unused-variable */
|
||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
||
var freeGlobal = objectTypes[typeof global] && global;
|
||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
||
exports.root = freeGlobal;
|
||
}
|
||
//# sourceMappingURL=root.js.map
|
||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
},{}],150:[function(require,module,exports){
|
||
var Observable_1 = require('../Observable');
|
||
var Symbol_iterator_1 = require('../util/Symbol_iterator');
|
||
var Symbol_observable_1 = require('../util/Symbol_observable');
|
||
var InnerSubscriber_1 = require('../InnerSubscriber');
|
||
var isArray = Array.isArray;
|
||
function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
|
||
var destination = new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex);
|
||
if (destination.isUnsubscribed) {
|
||
return;
|
||
}
|
||
if (result instanceof Observable_1.Observable) {
|
||
if (result._isScalar) {
|
||
destination.next(result.value);
|
||
destination.complete();
|
||
return;
|
||
}
|
||
else {
|
||
return result.subscribe(destination);
|
||
}
|
||
}
|
||
if (isArray(result)) {
|
||
for (var i = 0, len = result.length; i < len && !destination.isUnsubscribed; i++) {
|
||
destination.next(result[i]);
|
||
}
|
||
if (!destination.isUnsubscribed) {
|
||
destination.complete();
|
||
}
|
||
}
|
||
else if (typeof result.then === 'function') {
|
||
result.then(function (x) {
|
||
if (!destination.isUnsubscribed) {
|
||
destination.next(x);
|
||
destination.complete();
|
||
}
|
||
}, function (err) { return destination.error(err); })
|
||
.then(null, function (err) {
|
||
// Escaping the Promise trap: globally throw unhandled errors
|
||
setTimeout(function () { throw err; });
|
||
});
|
||
return destination;
|
||
}
|
||
else if (typeof result[Symbol_iterator_1.$$iterator] === 'function') {
|
||
for (var _i = 0; _i < result.length; _i++) {
|
||
var item = result[_i];
|
||
destination.next(item);
|
||
if (destination.isUnsubscribed) {
|
||
break;
|
||
}
|
||
}
|
||
if (!destination.isUnsubscribed) {
|
||
destination.complete();
|
||
}
|
||
}
|
||
else if (typeof result[Symbol_observable_1.$$observable] === 'function') {
|
||
var obs = result[Symbol_observable_1.$$observable]();
|
||
if (typeof obs.subscribe !== 'function') {
|
||
destination.error('invalid observable');
|
||
}
|
||
else {
|
||
return obs.subscribe(new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex));
|
||
}
|
||
}
|
||
else {
|
||
destination.error(new TypeError('unknown type returned'));
|
||
}
|
||
}
|
||
exports.subscribeToResult = subscribeToResult;
|
||
//# sourceMappingURL=subscribeToResult.js.map
|
||
},{"../InnerSubscriber":14,"../Observable":16,"../util/Symbol_iterator":140,"../util/Symbol_observable":141}],151:[function(require,module,exports){
|
||
function throwError(e) { throw e; }
|
||
exports.throwError = throwError;
|
||
//# sourceMappingURL=throwError.js.map
|
||
},{}],152:[function(require,module,exports){
|
||
var errorObject_1 = require('./errorObject');
|
||
var tryCatchTarget;
|
||
function tryCatcher() {
|
||
try {
|
||
return tryCatchTarget.apply(this, arguments);
|
||
}
|
||
catch (e) {
|
||
errorObject_1.errorObject.e = e;
|
||
return errorObject_1.errorObject;
|
||
}
|
||
}
|
||
function tryCatch(fn) {
|
||
tryCatchTarget = fn;
|
||
return tryCatcher;
|
||
}
|
||
exports.tryCatch = tryCatch;
|
||
;
|
||
//# sourceMappingURL=tryCatch.js.map
|
||
},{"./errorObject":143}],153:[function(require,module,exports){
|
||
function tryOrOnError(target) {
|
||
function tryCatcher() {
|
||
try {
|
||
tryCatcher.target.apply(this, arguments);
|
||
}
|
||
catch (e) {
|
||
this.error(e);
|
||
}
|
||
}
|
||
tryCatcher.target = target;
|
||
return tryCatcher;
|
||
}
|
||
exports.tryOrOnError = tryOrOnError;
|
||
//# sourceMappingURL=tryOrOnError.js.map
|
||
},{}]},{},[1]);
|