Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fetch-observable

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-observable - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

14

dist/lib/fetchObservable.js

@@ -59,2 +59,6 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**
* @copyright © 2015, Rick Wong. All rights reserved.
*/
var _PausableObservable = __webpack_require__(3);

@@ -68,5 +72,3 @@

return typeof thing === "string";
} /**
* @copyright © 2015, Rick Wong. All rights reserved.
*/
}

@@ -89,2 +91,4 @@ function isFunction(thing) {

var fetchFunc = options.fetch || fetch;
var observers = [];

@@ -120,7 +124,5 @@ var timeout = null;

var fetchFunc = options.fetch || fetch;
// Map all URLs to Fetch API calls.
var fetches = urls.map(function (url) {
return fetchFunc(url, options);
return fetchFunc(url, _extends({}, options, { refreshDelay: undefined, fetch: undefined }));
});

@@ -127,0 +129,0 @@

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fetchObservable=e():t.fetchObservable=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){return"string"==typeof t}function u(t){return"function"==typeof t}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=e.refreshDelay,r=void 0===n?!1:n,i=[],c=null,s=!1,a=0;(s=o(t))&&(t=[t]);var l=function h(){if(0!==i.length&&!p.paused()){var n=function(){r?c=setTimeout(h,u(r)?r(a++):r):(p.pause(),i.map(function(t){return t.complete()}),i=[])},o=e.fetch||fetch,f=t.map(function(t){return o(t,e)});Promise.all(f).then(function(t){i.map(function(e){return e.next(s?t[0]:t)}),n()})["catch"](function(t){i.map(function(e){return e.error(t)}),n()})}},p=new f["default"](function(t){return i.push(t),p.resume(),function(){i.splice(i.indexOf(t),1),i.length||p.pause()}},{onPause:function(){c&&(clearTimeout(c),c=null)},onResume:function(){c||l()}});return p}var c=n(3),f=r(c);t.exports=i},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function c(t){return"object"===("undefined"==typeof t?"undefined":i(t))&&"function"==typeof t.then&&"function"==typeof t["catch"]}var f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n(2),a=function(t){function e(){return r(this,e),o(this,Object.getPrototypeOf(e).apply(this,arguments))}return u(e,t),f(e,[{key:"map",value:function(t){var e=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=null,r=[],o=function(){n||(n=e.subscribe({next:function(e){try{e=t(e)}catch(n){return r.map(function(t){return t.error(n)})}return c(e)?e.then(function(t){return r.map(function(e){return e.next(t)})})["catch"](function(t){return r.map(function(e){return e.error(t)})}):void r.map(function(t){return t.next(e)})},error:function(t){return r.map(function(e){return e.error(t)})},complete:function(){return r.map(function(t){return t.complete()})}}))},u=function(){n&&n.unsubscribe(),n=null};return new this.constructor(function(t){return r.push(t),o(),function(){r.splice(r.indexOf(t),1),r.length||u()}})}}]),e}(s.Observable);t.exports=a},function(t,e,n){(function(t,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){u()&&!Symbol[t]&&Object.defineProperty(Symbol,t,{value:Symbol(t)})}function u(){return"function"==typeof Symbol}function i(t){return u()&&Boolean(Symbol[t])}function c(t){return i(t)?Symbol[t]:"@@"+t}function f(t,e){var n=t[e];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(t){var e=c("species");return e?t[e]:t}function a(t,e){Object.keys(e).forEach(function(n){var r=Object.getOwnPropertyDescriptor(e,n);r.enumerable=!1,Object.defineProperty(t,n,r)})}function l(t){var e=t._cleanup;e&&(t._cleanup=void 0,e())}function p(t){return void 0===t._observer}function h(t){p(t)||(t._observer=void 0,l(t))}function b(t){return function(e){t.unsubscribe()}}function y(t,e){if(Object(t)!==t)throw new TypeError("Observer must be an object");var n=new v(t),r=new m(n),o=f(t,"start");if(o&&o.call(t,r),p(n))return r;try{var u=e.call(void 0,n);if(null!=u){if("function"==typeof u.unsubscribe)u=b(u);else if("function"!=typeof u)throw new TypeError(u+" is not a function");n._cleanup=u}}catch(i){return n.error(i),r}return p(n)&&l(n),r}function v(t){this._observer=t,this._cleanup=void 0}function m(t){this._observer=t}function d(t){if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=d;var w=function(){if("undefined"!=typeof t&&"undefined"!=typeof n&&n.nextTick)return t.setImmediate?function(e){t.setImmediate(e)}:function(t){n.nextTick(t)};var e=self.MutationObserver||self.WebKitMutationObserver;if(e){var o=function(){var t=document.createElement("div"),n=function(e){return t.classList.toggle("x")},r=[],o=new e(function(t){for(r.length>1&&n();r.length>0;)r.shift()()});return o.observe(t,{attributes:!0}),{v:function(t){r.push(t),1===r.length&&n()}}}();if("object"===("undefined"==typeof o?"undefined":r(o)))return o.v}return function(t){setTimeout(t,0)}}();o("observable"),a(v.prototype={},{get closed(){return p(this)},next:function(t){if(!p(this)){var e=this._observer;try{var n=f(e,"next");if(!n)return;return n.call(e,t)}catch(r){try{h(this)}finally{throw r}}}},error:function(t){if(p(this))throw t;var e=this._observer;this._observer=void 0;try{var n=f(e,"error");if(!n)throw t;t=n.call(e,t)}catch(r){try{l(this)}finally{throw r}}return l(this),t},complete:function(t){if(!p(this)){var e=this._observer;this._observer=void 0;try{var n=f(e,"complete");t=n?n.call(e,t):void 0}catch(r){try{l(this)}finally{throw r}}return l(this),t}}}),a(m.prototype={},{unsubscribe:function(){h(this._observer)}}),a(d.prototype,{subscribe:function(t){return y(t,this._subscriber)},forEach:function(t){var e=this;return new Promise(function(n,r){if("function"!=typeof t)throw new TypeError(t+" is not a function");e.subscribe({next:function(e){try{return t(e)}catch(n){r(n)}},error:r,complete:n})})},map:function(t){var e=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=s(this.constructor);return new n(function(n){return e.subscribe({next:function(e){try{e=t(e)}catch(r){return n.error(r)}return n.next(e)},error:function(t){return n.error(t)},complete:function(t){return n.complete(t)}})})},filter:function(t){var e=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=s(this.constructor);return new n(function(n){return e.subscribe({next:function(e){try{if(!t(e))return}catch(r){return n.error(r)}return n.next(e)},error:function(t){return n.error(t)},complete:function(t){return n.complete(t)}})})}}),Object.defineProperty(d.prototype,c("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(t){var e="function"==typeof this?this:d;if(null==t)throw new TypeError(t+" is not an object");var n=f(t,c("observable"));if(n){var o=function(){var r=n.call(t);if(Object(r)!==r)throw new TypeError(r+" is not an object");return r.constructor===e?{v:r}:{v:new e(function(t){return r.subscribe(t)})}}();if("object"===("undefined"==typeof o?"undefined":r(o)))return o.v}return new e(function(e){w(function(n){if(!e.closed){try{if(i("iterator")){var r=!0,o=!1,u=void 0;try{for(var c,f=t[Symbol.iterator]();!(r=(c=f.next()).done);r=!0){var s=c.value;if(e.next(s),e.closed)return}}catch(a){o=!0,u=a}finally{try{!r&&f["return"]&&f["return"]()}finally{if(o)throw u}}}else{if(!Array.isArray(t))throw new Error(t+" is not an Array");for(var l=0;l<t.length;++l)if(e.next(t[l]),e.closed)return}}catch(p){return void e.error(p)}e.complete()}})})},of:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];var r="function"==typeof this?this:d;return new r(function(t){w(function(n){if(!t.closed){for(var r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}}),Object.defineProperty(d,c("species"),{get:function(){return this},configurable:!0})}).call(e,function(){return this}(),n(4))},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=function p(t,e,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,e);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:p(o,e,n)}if("value"in r)return r.value;var u=r.get;if(void 0!==u)return u.call(n)},s=n(1),a=r(s),l=function(t){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n.onPause,i=n.onResume;o(this,e);var c=u(this,Object.getPrototypeOf(e).call(this,t));return c.state="paused",c.onPause=r,c.onResume=i,c}return i(e,t),c(e,[{key:"pause",value:function(){return this.state="paused",this.onPause&&this.onPause.apply(this,arguments)}},{key:"resume",value:function(){return this.state="resumed",this.onResume&&this.onResume.apply(this,arguments)}},{key:"paused",value:function(){return"paused"===this.state}},{key:"map",value:function(t){var n=this,r=f(Object.getPrototypeOf(e.prototype),"map",this).call(this,t);return Object.assign(r,{pause:function(){return n.pause.apply(n,arguments)},resume:function(){return n.resume.apply(n,arguments)},paused:function(){return n.paused()}}),r}}]),e}(a["default"]);t.exports=l},function(t,e){function n(){s=!1,i.length?f=i.concat(f):a=-1,f.length&&r()}function r(){if(!s){var t=setTimeout(n);s=!0;for(var e=f.length;e;){for(i=f,f=[];++a<e;)i&&i[a].run();a=-1,e=f.length}i=null,s=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function u(){}var i,c=t.exports={},f=[],s=!1,a=-1;c.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new o(t,e)),1!==f.length||s||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=u,c.addListener=u,c.once=u,c.off=u,c.removeListener=u,c.removeAllListeners=u,c.emit=u,c.binding=function(t){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(t){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fetchObservable=e():t.fetchObservable=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){return"string"==typeof t}function u(t){return"function"==typeof t}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=e.refreshDelay,r=void 0===n?!1:n,i=e.fetch||fetch,f=[],a=null,l=!1,p=0;(l=o(t))&&(t=[t]);var h=function y(){if(0!==f.length&&!b.paused()){var n=function(){r?a=setTimeout(y,u(r)?r(p++):r):(b.pause(),f.map(function(t){return t.complete()}),f=[])},o=t.map(function(t){return i(t,c({},e,{refreshDelay:void 0,fetch:void 0}))});Promise.all(o).then(function(t){f.map(function(e){return e.next(l?t[0]:t)}),n()})["catch"](function(t){f.map(function(e){return e.error(t)}),n()})}},b=new s["default"](function(t){return f.push(t),b.resume(),function(){f.splice(f.indexOf(t),1),f.length||b.pause()}},{onPause:function(){a&&(clearTimeout(a),a=null)},onResume:function(){a||h()}});return b}var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=n(3),s=r(f);t.exports=i},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function c(t){return"object"===("undefined"==typeof t?"undefined":i(t))&&"function"==typeof t.then&&"function"==typeof t["catch"]}var f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n(2),a=function(t){function e(){return r(this,e),o(this,Object.getPrototypeOf(e).apply(this,arguments))}return u(e,t),f(e,[{key:"map",value:function(t){var e=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=null,r=[],o=function(){n||(n=e.subscribe({next:function(e){try{e=t(e)}catch(n){return r.map(function(t){return t.error(n)})}return c(e)?e.then(function(t){return r.map(function(e){return e.next(t)})})["catch"](function(t){return r.map(function(e){return e.error(t)})}):void r.map(function(t){return t.next(e)})},error:function(t){return r.map(function(e){return e.error(t)})},complete:function(){return r.map(function(t){return t.complete()})}}))},u=function(){n&&n.unsubscribe(),n=null};return new this.constructor(function(t){return r.push(t),o(),function(){r.splice(r.indexOf(t),1),r.length||u()}})}}]),e}(s.Observable);t.exports=a},function(t,e,n){(function(t,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){u()&&!Symbol[t]&&Object.defineProperty(Symbol,t,{value:Symbol(t)})}function u(){return"function"==typeof Symbol}function i(t){return u()&&Boolean(Symbol[t])}function c(t){return i(t)?Symbol[t]:"@@"+t}function f(t,e){var n=t[e];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(t){var e=c("species");return e?t[e]:t}function a(t,e){Object.keys(e).forEach(function(n){var r=Object.getOwnPropertyDescriptor(e,n);r.enumerable=!1,Object.defineProperty(t,n,r)})}function l(t){var e=t._cleanup;e&&(t._cleanup=void 0,e())}function p(t){return void 0===t._observer}function h(t){p(t)||(t._observer=void 0,l(t))}function b(t){return function(e){t.unsubscribe()}}function y(t,e){if(Object(t)!==t)throw new TypeError("Observer must be an object");var n=new v(t),r=new m(n),o=f(t,"start");if(o&&o.call(t,r),p(n))return r;try{var u=e.call(void 0,n);if(null!=u){if("function"==typeof u.unsubscribe)u=b(u);else if("function"!=typeof u)throw new TypeError(u+" is not a function");n._cleanup=u}}catch(i){return n.error(i),r}return p(n)&&l(n),r}function v(t){this._observer=t,this._cleanup=void 0}function m(t){this._observer=t}function d(t){if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=d;var w=function(){if("undefined"!=typeof t&&"undefined"!=typeof n&&n.nextTick)return t.setImmediate?function(e){t.setImmediate(e)}:function(t){n.nextTick(t)};var e=self.MutationObserver||self.WebKitMutationObserver;if(e){var o=function(){var t=document.createElement("div"),n=function(e){return t.classList.toggle("x")},r=[],o=new e(function(t){for(r.length>1&&n();r.length>0;)r.shift()()});return o.observe(t,{attributes:!0}),{v:function(t){r.push(t),1===r.length&&n()}}}();if("object"===("undefined"==typeof o?"undefined":r(o)))return o.v}return function(t){setTimeout(t,0)}}();o("observable"),a(v.prototype={},{get closed(){return p(this)},next:function(t){if(!p(this)){var e=this._observer;try{var n=f(e,"next");if(!n)return;return n.call(e,t)}catch(r){try{h(this)}finally{throw r}}}},error:function(t){if(p(this))throw t;var e=this._observer;this._observer=void 0;try{var n=f(e,"error");if(!n)throw t;t=n.call(e,t)}catch(r){try{l(this)}finally{throw r}}return l(this),t},complete:function(t){if(!p(this)){var e=this._observer;this._observer=void 0;try{var n=f(e,"complete");t=n?n.call(e,t):void 0}catch(r){try{l(this)}finally{throw r}}return l(this),t}}}),a(m.prototype={},{unsubscribe:function(){h(this._observer)}}),a(d.prototype,{subscribe:function(t){return y(t,this._subscriber)},forEach:function(t){var e=this;return new Promise(function(n,r){if("function"!=typeof t)throw new TypeError(t+" is not a function");e.subscribe({next:function(e){try{return t(e)}catch(n){r(n)}},error:r,complete:n})})},map:function(t){var e=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=s(this.constructor);return new n(function(n){return e.subscribe({next:function(e){try{e=t(e)}catch(r){return n.error(r)}return n.next(e)},error:function(t){return n.error(t)},complete:function(t){return n.complete(t)}})})},filter:function(t){var e=this;if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=s(this.constructor);return new n(function(n){return e.subscribe({next:function(e){try{if(!t(e))return}catch(r){return n.error(r)}return n.next(e)},error:function(t){return n.error(t)},complete:function(t){return n.complete(t)}})})}}),Object.defineProperty(d.prototype,c("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(t){var e="function"==typeof this?this:d;if(null==t)throw new TypeError(t+" is not an object");var n=f(t,c("observable"));if(n){var o=function(){var r=n.call(t);if(Object(r)!==r)throw new TypeError(r+" is not an object");return r.constructor===e?{v:r}:{v:new e(function(t){return r.subscribe(t)})}}();if("object"===("undefined"==typeof o?"undefined":r(o)))return o.v}return new e(function(e){w(function(n){if(!e.closed){try{if(i("iterator")){var r=!0,o=!1,u=void 0;try{for(var c,f=t[Symbol.iterator]();!(r=(c=f.next()).done);r=!0){var s=c.value;if(e.next(s),e.closed)return}}catch(a){o=!0,u=a}finally{try{!r&&f["return"]&&f["return"]()}finally{if(o)throw u}}}else{if(!Array.isArray(t))throw new Error(t+" is not an Array");for(var l=0;l<t.length;++l)if(e.next(t[l]),e.closed)return}}catch(p){return void e.error(p)}e.complete()}})})},of:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];var r="function"==typeof this?this:d;return new r(function(t){w(function(n){if(!t.closed){for(var r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}}),Object.defineProperty(d,c("species"),{get:function(){return this},configurable:!0})}).call(e,function(){return this}(),n(4))},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=function p(t,e,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,e);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:p(o,e,n)}if("value"in r)return r.value;var u=r.get;if(void 0!==u)return u.call(n)},s=n(1),a=r(s),l=function(t){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n.onPause,i=n.onResume;o(this,e);var c=u(this,Object.getPrototypeOf(e).call(this,t));return c.state="paused",c.onPause=r,c.onResume=i,c}return i(e,t),c(e,[{key:"pause",value:function(){return this.state="paused",this.onPause&&this.onPause.apply(this,arguments)}},{key:"resume",value:function(){return this.state="resumed",this.onResume&&this.onResume.apply(this,arguments)}},{key:"paused",value:function(){return"paused"===this.state}},{key:"map",value:function(t){var n=this,r=f(Object.getPrototypeOf(e.prototype),"map",this).call(this,t);return Object.assign(r,{pause:function(){return n.pause.apply(n,arguments)},resume:function(){return n.resume.apply(n,arguments)},paused:function(){return n.paused()}}),r}}]),e}(a["default"]);t.exports=l},function(t,e){function n(){s=!1,i.length?f=i.concat(f):a=-1,f.length&&r()}function r(){if(!s){var t=setTimeout(n);s=!0;for(var e=f.length;e;){for(i=f,f=[];++a<e;)i&&i[a].run();a=-1,e=f.length}i=null,s=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function u(){}var i,c=t.exports={},f=[],s=!1,a=-1;c.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new o(t,e)),1!==f.length||s||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=u,c.addListener=u,c.once=u,c.off=u,c.removeListener=u,c.removeAllListeners=u,c.emit=u,c.binding=function(t){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(t){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}}])});
{
"name": "fetch-observable",
"description": "Observable-based Fetch API",
"version": "1.2.0",
"version": "1.2.1",
"license": "BSD-3-Clause",

@@ -24,17 +24,16 @@ "repository": {

},
"dependencies": {
},
"dependencies": {},
"devDependencies": {
"babel": "6.1.18",
"babel-core": "6.1.21",
"babel-loader": "6.1.0",
"babel-preset-es2015": "6.1.18",
"babel-preset-react": "6.1.18",
"concurrently": "0.1.1",
"babel": "6.3.13",
"babel-core": "6.3.21",
"babel-loader": "6.2.0",
"babel-preset-es2015": "6.3.13",
"babel-preset-stage-0": "6.3.13",
"concurrently": "1.0.0",
"isomorphic-fetch": "2.2.0",
"json-loader": "0.5.3",
"react": "0.14.2",
"react-dom": "0.14.2",
"webpack": "1.12.6",
"webpack-dev-server": "1.12.1"
"json-loader": "0.5.4",
"react": "0.14.3",
"react-dom": "0.14.3",
"webpack": "1.12.9",
"webpack-dev-server": "1.14.0"
},

@@ -41,0 +40,0 @@ "engines": {

@@ -23,2 +23,3 @@ /**

const {refreshDelay = false} = options;
const fetchFunc = options.fetch || fetch;

@@ -57,6 +58,6 @@ let observers = [];

const fetchFunc = options.fetch || fetch;
// Map all URLs to Fetch API calls.
let fetches = urls.map((url) => fetchFunc(url, options));
let fetches = urls.map(
(url) => fetchFunc(url, {...options, refreshDelay: undefined, fetch: undefined})
);

@@ -63,0 +64,0 @@ // Wait for all the results to come in, then notify observers.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc