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

redux-saga

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-saga - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

8

dist/redux-saga.js

@@ -62,3 +62,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

});
exports.storeIO = exports.runSaga = exports.as = exports.cancel = exports.join = exports.fork = exports.cps = exports.call = exports.race = exports.put = exports.take = exports.MANUAL_CANCEL = exports.PARALLEL_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = exports.SagaCancellationException = undefined;
exports.storeIO = exports.runSaga = exports.as = exports.cancel = exports.join = exports.fork = exports.cps = exports.apply = exports.call = exports.race = exports.put = exports.take = exports.MANUAL_CANCEL = exports.PARALLEL_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = exports.SagaCancellationException = undefined;

@@ -118,2 +118,8 @@ var _proc = __webpack_require__(2);

});
Object.defineProperty(exports, 'apply', {
enumerable: true,
get: function get() {
return _io.apply;
}
});
Object.defineProperty(exports, 'cps', {

@@ -120,0 +126,0 @@ enumerable: true,

2

dist/redux-saga.min.js

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

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var u=r[t]={exports:{},id:t,loaded:!1};return e[t].call(u.exports,u,u.exports,n),u.loaded=!0,u.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.storeIO=n.runSaga=n.as=n.cancel=n.join=n.fork=n.cps=n.call=n.race=n.put=n.take=n.MANUAL_CANCEL=n.PARALLEL_AUTO_CANCEL=n.RACE_AUTO_CANCEL=n.SagaCancellationException=void 0;var u=r(2);Object.defineProperty(n,"SagaCancellationException",{enumerable:!0,get:function(){return u.SagaCancellationException}}),Object.defineProperty(n,"RACE_AUTO_CANCEL",{enumerable:!0,get:function(){return u.RACE_AUTO_CANCEL}}),Object.defineProperty(n,"PARALLEL_AUTO_CANCEL",{enumerable:!0,get:function(){return u.PARALLEL_AUTO_CANCEL}}),Object.defineProperty(n,"MANUAL_CANCEL",{enumerable:!0,get:function(){return u.MANUAL_CANCEL}});var o=r(4);Object.defineProperty(n,"take",{enumerable:!0,get:function(){return o.take}}),Object.defineProperty(n,"put",{enumerable:!0,get:function(){return o.put}}),Object.defineProperty(n,"race",{enumerable:!0,get:function(){return o.race}}),Object.defineProperty(n,"call",{enumerable:!0,get:function(){return o.call}}),Object.defineProperty(n,"cps",{enumerable:!0,get:function(){return o.cps}}),Object.defineProperty(n,"fork",{enumerable:!0,get:function(){return o.fork}}),Object.defineProperty(n,"join",{enumerable:!0,get:function(){return o.join}}),Object.defineProperty(n,"cancel",{enumerable:!0,get:function(){return o.cancel}}),Object.defineProperty(n,"as",{enumerable:!0,get:function(){return o.as}});var a=r(7);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return a.runSaga}}),Object.defineProperty(n,"storeIO",{enumerable:!0,get:function(){return a.storeIO}});var i=r(5),c=t(i);n.default=c.default},function(e,n){"use strict";function r(e,n,r){if(!n(e))throw new Error(r)}function t(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},s[0],this)}function u(e,n){var r=e.indexOf(n);r>=0&&e.splice(r,1)}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=f({},e),r=new Promise(function(e,r){n.resolve=e,n.reject=r});return n.promise=r,n}function a(e){for(var n=[],r=0;e>r;r++)n.push(o());return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return function(){return++e}}function c(e){return Promise.resolve(1).then(function(){return e()})}var f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};Object.defineProperty(n,"__esModule",{value:!0}),n.check=r,n.remove=u,n.deferred=o,n.arrayOfDeffered=a,n.autoInc=i,n.asap=c;var s=[t].map(regeneratorRuntime.mark),l=n.TASK=Symbol("TASK"),d=(n.kTrue=function(){return!0},n.noop=function(){},t.constructor),p=n.is={undef:function(e){return null===e||void 0===e},func:function(e){return"function"==typeof e},array:Array.isArray,promise:function(e){return e&&"function"==typeof e.then},generator:function(e){return p.func(e)&&e.constructor===d},iterator:function(e){return e&&"function"==typeof e.next},"throw":function(e){return e&&"function"==typeof e.throw},task:function(e){return e&&e[l]}}},function(e,n,r){"use strict";function t(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}function u(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function o(e){if(Array.isArray(e)){for(var n=0,r=Array(e.length);n<e.length;n++)r[n]=e[n];return r}return Array.from(e)}function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e){function n(u,o){if(e._isRunning)try{if(o&&!x)throw u;var a=o?e.throw(u):e.next(u);if(a.done)r(a.value);else{var i=t(a.value,k);I.promise[R]=i[R],i.then(n,function(e){return n(e,!0)})}}catch(c){console.warn(w+": uncaught",c),r(c,!0)}}function r(n,r){e._isRunning=!1,r?(e._error=n,I.reject(n)):(e._result=n,I.resolve(n)),U()}function t(e,n){var r=arguments.length<=2||void 0===arguments[2]?"":arguments[2],t=v();N(l.effectTriggered(t,n,r,e));var u=void 0,o=c.is.array(e)?y(e,t):c.is.iterator(e)?i(e,P,j,N,t).done:(u=f.as.take(e))?a(u):(u=f.as.put(e))?s(u):(u=f.as.race(e))?h(u,t):(u=f.as.call(e))?A(u.context,u.fn,u.args,t):(u=f.as.cps(e))?E(u.fn,u.args):(u=f.as.fork(e))?O(u.task,u.args,t):(u=f.as.join(e))?C(u):(u=f.as.cancel(e))?b(u):Promise.resolve(e),d=(0,c.deferred)(),p=!0,m=function(e){return function(n){p&&(p=!1,e(n))}};return o.then(m(d.resolve),m(d.reject)),d.promise[R]=function(e){var n=e.type,r=e.origin;if(p){p=!1;var t=new _(n,w,r);T(o,t),d.reject(t)}},d.promise.then(function(e){return N(l.effectResolved(t,e))},function(e){return N(l.effectRejected(t,e))}),d.promise}function a(e){var n=(0,c.deferred)({match:(0,f.matcher)(e),pattern:e});S.push(n);var r=function(){return(0,c.remove)(S,n)};return n.promise.then(r,r),n.promise[R]=r,n.promise}function s(e){return(0,c.asap)(function(){return j(e)})}function A(e,n,r,t){var u=n.apply(e,r);return c.is.iterator(u)?i(u,P,j,N,t,n.name).done:Promise.resolve(u)}function E(e,n){return new Promise(function(r,t){e.apply(void 0,o(n.concat(function(e,n){return c.is.undef(e)?r(n):t(e)})))})}function O(e,n,r){var t=void 0,u=void 0,a=c.is.func(e);a&&(t=e.apply(void 0,o(n))),u=c.is.iterator(t)?t:c.is.iterator(e)?e:regeneratorRuntime.mark(function s(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,a?t:e;case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}},s,this)})();var f=a?e.name:"anonymous";return Promise.resolve(i(u,P,j,N,r,f,!0))}function C(e){return e.done}function b(e){return e.done[R](new _(g,"",w)),Promise.resolve()}function y(e,n){var r=e.map(function(e){return t(e,n)}),u=Promise.all(r);return u[R]=function(e){r.forEach(function(n){return T(n,e)})},u.catch(function(){u[R](new _(p,w,w))}),u}function h(e,n){var r=[],o=Promise.race(Object.keys(e).map(function(o){var a=t(e[o],n,o);return r.push(a),a.then(function(e){return u({},o,e)},function(e){return Promise.reject(u({},o,e))})}));o[R]=function(e){r.forEach(function(n){return T(n,e)})};var a=function(){return o[R](new _(m,w,w))};return o.then(a,a),o}function L(e,n,r,t,o){var a;return a={},u(a,c.TASK,!0),u(a,"id",e),u(a,"name",n),u(a,"done",t),u(a,"forked",o),u(a,"isRunning",function(){return r._isRunning}),u(a,"getResult",function(){return r._result}),u(a,"getError",function(){return r._error}),a}function T(e,n){e[R]&&e[R](n)}var P=arguments.length<=1||void 0===arguments[1]?function(){return c.noop}:arguments[1],j=arguments.length<=2||void 0===arguments[2]?c.noop:arguments[2],N=arguments.length<=3||void 0===arguments[3]?c.noop:arguments[3],k=arguments.length<=4||void 0===arguments[4]?0:arguments[4],w=arguments.length<=5||void 0===arguments[5]?"anonymous":arguments[5];(0,c.check)(e,c.is.iterator,d);var S=[],x=c.is.throw(e),I=(0,c.deferred)(),U=P(function(e){S.forEach(function(n){n.match(e)&&n.resolve(e)})});return e._isRunning=!0,n(),L(k,w,e,I.promise)}Object.defineProperty(n,"__esModule",{value:!0}),n.SagaCancellationException=n.CANCEL=n.MANUAL_CANCEL=n.RACE_AUTO_CANCEL=n.PARALLEL_AUTO_CANCEL=n.NOT_ITERATOR_ERROR=void 0,n.default=i;var c=r(1),f=r(4),s=r(6),l=t(s),d=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",p=n.PARALLEL_AUTO_CANCEL="PARALLEL_AUTO_CANCEL",m=n.RACE_AUTO_CANCEL="RACE_AUTO_CANCEL",g=n.MANUAL_CANCEL="MANUAL_CANCEL",v=(0,c.autoInc)(),R=n.CANCEL=Symbol("@@redux-saga/cancelPromise"),_=n.SagaCancellationException=function A(e,n,r){a(this,A),this.type=e,this.saga=n,this.origin=r}},function(e,n,r){"use strict";function t(){function e(e){return r.push(e),function(){return(0,u.remove)(r,e)}}function n(e){r.slice().forEach(function(n){return n(e)})}var r=[];return{subscribe:e,emit:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t;var u=r(1)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function u(e){return("*"===e?j.wildcard:m.is.array(e)?j.array:m.is.func(e)?j.predicate:j.default)(e)}function o(e){return P(E,m.is.undef(e)?"*":e)}function a(e){return P(O,e)}function i(e){return P(C,e)}function c(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return f(null,e,r)}function f(e,n){var r=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return(0,m.check)(n,m.is.func,g),P(b,{context:e,fn:n,args:r})}function s(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return(0,m.check)(e,m.is.func,v),P(y,{fn:e,args:r})}function l(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return P(h,{task:e,args:r})}function d(e){if(!N(e))throw new Error(R);return P(L,e)}function p(e){if(!N(e))throw new Error(_);return P(T,e)}Object.defineProperty(n,"__esModule",{value:!0}),n.as=n.CANCEL_ARG_ERROR=n.JOIN_ARG_ERROR=n.FORK_ARG_ERROR=n.CPS_FUNCTION_ARG_ERROR=n.CALL_FUNCTION_ARG_ERROR=void 0,n.matcher=u,n.take=o,n.put=a,n.race=i,n.call=c,n.apply=f,n.cps=s,n.fork=l,n.join=d,n.cancel=p;var m=r(1),g=n.CALL_FUNCTION_ARG_ERROR="call first argument must be a function",v=n.CPS_FUNCTION_ARG_ERROR="cps first argument must be a function",R=(n.FORK_ARG_ERROR="fork first argument must be a generator function or an iterator",n.JOIN_ARG_ERROR="join argument must be a valid task (a result of a fork)"),_=n.CANCEL_ARG_ERROR="cancel argument must be a valid task (a result of a fork)",A=Symbol("IO"),E="TAKE",O="PUT",C="RACE",b="CALL",y="CPS",h="FORK",L="JOIN",T="CANCEL",P=function(e,n){var r;return r={},t(r,A,!0),t(r,e,n),r},j={wildcard:function(){return m.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},N=function(e){return e[m.TASK]};n.as={take:function(e){return e&&e[A]&&e[E]},put:function(e){return e&&e[A]&&e[O]},race:function(e){return e&&e[A]&&e[C]},call:function(e){return e&&e[A]&&e[b]},cps:function(e){return e&&e[A]&&e[y]},fork:function(e){return e&&e[A]&&e[h]},join:function(e){return e&&e[A]&&e[L]},cancel:function(e){return e&&e[A]&&e[T]}}},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var u=r(1),o=r(2),a=t(o),i=r(3),c=t(i);n.default=function(){for(var e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return function(e){var r=e.getState,t=e.dispatch,o=(0,c.default)();return n.forEach(function(e){(0,a.default)(e(r),o.subscribe,t,function(e){return(0,u.asap)(function(){return t(e)})},0,e.name)}),function(e){return function(n){var r=e(n);return o.emit(n),r}}}}},function(e,n){"use strict";function r(e,n,r,t){return{type:o,effectId:e,parentEffectId:n,label:r,effect:t}}function t(e,n){return{type:a,effectId:e,result:n}}function u(e,n){return{type:i,effectId:e,error:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.effectTriggered=r,n.effectResolved=t,n.effectRejected=u;var o=n.EFFECT_TRIGGERED="EFFECT_TRIGGERED",a=n.EFFECT_RESOLVED="EFFECT_RESOLVED",i=n.EFFECT_REJECTED="EFFECT_REJECTED"},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}function u(e){if(e[d])return e[d];var n=(0,s.default)(),r=e.dispatch;return e.dispatch=function(e){var t=r(e);return n.emit(e),t},e[d]={subscribe:n.subscribe,dispatch:e.dispatch},e[d]}function o(e,n){var r=n.subscribe,t=n.dispatch,u=arguments.length<=2||void 0===arguments[2]?a.noop:arguments[2];return(0,a.check)(e,a.is.iterator,l),(0,c.default)(e,r,t,u)}Object.defineProperty(n,"__esModule",{value:!0}),n.NOT_ITERATOR_ERROR=void 0,n.storeIO=u,n.runSaga=o;var a=r(1),i=r(2),c=t(i),f=r(3),s=t(f),l=n.NOT_ITERATOR_ERROR="runSaga must be called on an iterator",d=Symbol("IO")}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var u=r[t]={exports:{},id:t,loaded:!1};return e[t].call(u.exports,u,u.exports,n),u.loaded=!0,u.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.storeIO=n.runSaga=n.as=n.cancel=n.join=n.fork=n.cps=n.apply=n.call=n.race=n.put=n.take=n.MANUAL_CANCEL=n.PARALLEL_AUTO_CANCEL=n.RACE_AUTO_CANCEL=n.SagaCancellationException=void 0;var u=r(2);Object.defineProperty(n,"SagaCancellationException",{enumerable:!0,get:function(){return u.SagaCancellationException}}),Object.defineProperty(n,"RACE_AUTO_CANCEL",{enumerable:!0,get:function(){return u.RACE_AUTO_CANCEL}}),Object.defineProperty(n,"PARALLEL_AUTO_CANCEL",{enumerable:!0,get:function(){return u.PARALLEL_AUTO_CANCEL}}),Object.defineProperty(n,"MANUAL_CANCEL",{enumerable:!0,get:function(){return u.MANUAL_CANCEL}});var o=r(4);Object.defineProperty(n,"take",{enumerable:!0,get:function(){return o.take}}),Object.defineProperty(n,"put",{enumerable:!0,get:function(){return o.put}}),Object.defineProperty(n,"race",{enumerable:!0,get:function(){return o.race}}),Object.defineProperty(n,"call",{enumerable:!0,get:function(){return o.call}}),Object.defineProperty(n,"apply",{enumerable:!0,get:function(){return o.apply}}),Object.defineProperty(n,"cps",{enumerable:!0,get:function(){return o.cps}}),Object.defineProperty(n,"fork",{enumerable:!0,get:function(){return o.fork}}),Object.defineProperty(n,"join",{enumerable:!0,get:function(){return o.join}}),Object.defineProperty(n,"cancel",{enumerable:!0,get:function(){return o.cancel}}),Object.defineProperty(n,"as",{enumerable:!0,get:function(){return o.as}});var a=r(7);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return a.runSaga}}),Object.defineProperty(n,"storeIO",{enumerable:!0,get:function(){return a.storeIO}});var i=r(5),c=t(i);n.default=c.default},function(e,n){"use strict";function r(e,n,r){if(!n(e))throw new Error(r)}function t(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},s[0],this)}function u(e,n){var r=e.indexOf(n);r>=0&&e.splice(r,1)}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=f({},e),r=new Promise(function(e,r){n.resolve=e,n.reject=r});return n.promise=r,n}function a(e){for(var n=[],r=0;e>r;r++)n.push(o());return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return function(){return++e}}function c(e){return Promise.resolve(1).then(function(){return e()})}var f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};Object.defineProperty(n,"__esModule",{value:!0}),n.check=r,n.remove=u,n.deferred=o,n.arrayOfDeffered=a,n.autoInc=i,n.asap=c;var s=[t].map(regeneratorRuntime.mark),l=n.TASK=Symbol("TASK"),d=(n.kTrue=function(){return!0},n.noop=function(){},t.constructor),p=n.is={undef:function(e){return null===e||void 0===e},func:function(e){return"function"==typeof e},array:Array.isArray,promise:function(e){return e&&"function"==typeof e.then},generator:function(e){return p.func(e)&&e.constructor===d},iterator:function(e){return e&&"function"==typeof e.next},"throw":function(e){return e&&"function"==typeof e.throw},task:function(e){return e&&e[l]}}},function(e,n,r){"use strict";function t(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}function u(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function o(e){if(Array.isArray(e)){for(var n=0,r=Array(e.length);n<e.length;n++)r[n]=e[n];return r}return Array.from(e)}function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e){function n(u,o){if(e._isRunning)try{if(o&&!x)throw u;var a=o?e.throw(u):e.next(u);if(a.done)r(a.value);else{var i=t(a.value,k);I.promise[R]=i[R],i.then(n,function(e){return n(e,!0)})}}catch(c){console.warn(w+": uncaught",c),r(c,!0)}}function r(n,r){e._isRunning=!1,r?(e._error=n,I.reject(n)):(e._result=n,I.resolve(n)),U()}function t(e,n){var r=arguments.length<=2||void 0===arguments[2]?"":arguments[2],t=v();N(l.effectTriggered(t,n,r,e));var u=void 0,o=c.is.array(e)?C(e,t):c.is.iterator(e)?i(e,T,j,N,t).done:(u=f.as.take(e))?a(u):(u=f.as.put(e))?s(u):(u=f.as.race(e))?h(u,t):(u=f.as.call(e))?A(u.context,u.fn,u.args,t):(u=f.as.cps(e))?E(u.fn,u.args):(u=f.as.fork(e))?O(u.task,u.args,t):(u=f.as.join(e))?b(u):(u=f.as.cancel(e))?y(u):Promise.resolve(e),d=(0,c.deferred)(),p=!0,m=function(e){return function(n){p&&(p=!1,e(n))}};return o.then(m(d.resolve),m(d.reject)),d.promise[R]=function(e){var n=e.type,r=e.origin;if(p){p=!1;var t=new _(n,w,r);P(o,t),d.reject(t)}},d.promise.then(function(e){return N(l.effectResolved(t,e))},function(e){return N(l.effectRejected(t,e))}),d.promise}function a(e){var n=(0,c.deferred)({match:(0,f.matcher)(e),pattern:e});S.push(n);var r=function(){return(0,c.remove)(S,n)};return n.promise.then(r,r),n.promise[R]=r,n.promise}function s(e){return(0,c.asap)(function(){return j(e)})}function A(e,n,r,t){var u=n.apply(e,r);return c.is.iterator(u)?i(u,T,j,N,t,n.name).done:Promise.resolve(u)}function E(e,n){return new Promise(function(r,t){e.apply(void 0,o(n.concat(function(e,n){return c.is.undef(e)?r(n):t(e)})))})}function O(e,n,r){var t=void 0,u=void 0,a=c.is.func(e);a&&(t=e.apply(void 0,o(n))),u=c.is.iterator(t)?t:c.is.iterator(e)?e:regeneratorRuntime.mark(function s(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,a?t:e;case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}},s,this)})();var f=a?e.name:"anonymous";return Promise.resolve(i(u,T,j,N,r,f,!0))}function b(e){return e.done}function y(e){return e.done[R](new _(g,"",w)),Promise.resolve()}function C(e,n){var r=e.map(function(e){return t(e,n)}),u=Promise.all(r);return u[R]=function(e){r.forEach(function(n){return P(n,e)})},u.catch(function(){u[R](new _(p,w,w))}),u}function h(e,n){var r=[],o=Promise.race(Object.keys(e).map(function(o){var a=t(e[o],n,o);return r.push(a),a.then(function(e){return u({},o,e)},function(e){return Promise.reject(u({},o,e))})}));o[R]=function(e){r.forEach(function(n){return P(n,e)})};var a=function(){return o[R](new _(m,w,w))};return o.then(a,a),o}function L(e,n,r,t,o){var a;return a={},u(a,c.TASK,!0),u(a,"id",e),u(a,"name",n),u(a,"done",t),u(a,"forked",o),u(a,"isRunning",function(){return r._isRunning}),u(a,"getResult",function(){return r._result}),u(a,"getError",function(){return r._error}),a}function P(e,n){e[R]&&e[R](n)}var T=arguments.length<=1||void 0===arguments[1]?function(){return c.noop}:arguments[1],j=arguments.length<=2||void 0===arguments[2]?c.noop:arguments[2],N=arguments.length<=3||void 0===arguments[3]?c.noop:arguments[3],k=arguments.length<=4||void 0===arguments[4]?0:arguments[4],w=arguments.length<=5||void 0===arguments[5]?"anonymous":arguments[5];(0,c.check)(e,c.is.iterator,d);var S=[],x=c.is.throw(e),I=(0,c.deferred)(),U=T(function(e){S.forEach(function(n){n.match(e)&&n.resolve(e)})});return e._isRunning=!0,n(),L(k,w,e,I.promise)}Object.defineProperty(n,"__esModule",{value:!0}),n.SagaCancellationException=n.CANCEL=n.MANUAL_CANCEL=n.RACE_AUTO_CANCEL=n.PARALLEL_AUTO_CANCEL=n.NOT_ITERATOR_ERROR=void 0,n.default=i;var c=r(1),f=r(4),s=r(6),l=t(s),d=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",p=n.PARALLEL_AUTO_CANCEL="PARALLEL_AUTO_CANCEL",m=n.RACE_AUTO_CANCEL="RACE_AUTO_CANCEL",g=n.MANUAL_CANCEL="MANUAL_CANCEL",v=(0,c.autoInc)(),R=n.CANCEL=Symbol("@@redux-saga/cancelPromise"),_=n.SagaCancellationException=function A(e,n,r){a(this,A),this.type=e,this.saga=n,this.origin=r}},function(e,n,r){"use strict";function t(){function e(e){return r.push(e),function(){return(0,u.remove)(r,e)}}function n(e){r.slice().forEach(function(n){return n(e)})}var r=[];return{subscribe:e,emit:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t;var u=r(1)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function u(e){return("*"===e?j.wildcard:m.is.array(e)?j.array:m.is.func(e)?j.predicate:j.default)(e)}function o(e){return T(E,m.is.undef(e)?"*":e)}function a(e){return T(O,e)}function i(e){return T(b,e)}function c(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return f(null,e,r)}function f(e,n){var r=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return(0,m.check)(n,m.is.func,g),T(y,{context:e,fn:n,args:r})}function s(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return(0,m.check)(e,m.is.func,v),T(C,{fn:e,args:r})}function l(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;n>t;t++)r[t-1]=arguments[t];return T(h,{task:e,args:r})}function d(e){if(!N(e))throw new Error(R);return T(L,e)}function p(e){if(!N(e))throw new Error(_);return T(P,e)}Object.defineProperty(n,"__esModule",{value:!0}),n.as=n.CANCEL_ARG_ERROR=n.JOIN_ARG_ERROR=n.FORK_ARG_ERROR=n.CPS_FUNCTION_ARG_ERROR=n.CALL_FUNCTION_ARG_ERROR=void 0,n.matcher=u,n.take=o,n.put=a,n.race=i,n.call=c,n.apply=f,n.cps=s,n.fork=l,n.join=d,n.cancel=p;var m=r(1),g=n.CALL_FUNCTION_ARG_ERROR="call first argument must be a function",v=n.CPS_FUNCTION_ARG_ERROR="cps first argument must be a function",R=(n.FORK_ARG_ERROR="fork first argument must be a generator function or an iterator",n.JOIN_ARG_ERROR="join argument must be a valid task (a result of a fork)"),_=n.CANCEL_ARG_ERROR="cancel argument must be a valid task (a result of a fork)",A=Symbol("IO"),E="TAKE",O="PUT",b="RACE",y="CALL",C="CPS",h="FORK",L="JOIN",P="CANCEL",T=function(e,n){var r;return r={},t(r,A,!0),t(r,e,n),r},j={wildcard:function(){return m.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},N=function(e){return e[m.TASK]};n.as={take:function(e){return e&&e[A]&&e[E]},put:function(e){return e&&e[A]&&e[O]},race:function(e){return e&&e[A]&&e[b]},call:function(e){return e&&e[A]&&e[y]},cps:function(e){return e&&e[A]&&e[C]},fork:function(e){return e&&e[A]&&e[h]},join:function(e){return e&&e[A]&&e[L]},cancel:function(e){return e&&e[A]&&e[P]}}},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var u=r(1),o=r(2),a=t(o),i=r(3),c=t(i);n.default=function(){for(var e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return function(e){var r=e.getState,t=e.dispatch,o=(0,c.default)();return n.forEach(function(e){(0,a.default)(e(r),o.subscribe,t,function(e){return(0,u.asap)(function(){return t(e)})},0,e.name)}),function(e){return function(n){var r=e(n);return o.emit(n),r}}}}},function(e,n){"use strict";function r(e,n,r,t){return{type:o,effectId:e,parentEffectId:n,label:r,effect:t}}function t(e,n){return{type:a,effectId:e,result:n}}function u(e,n){return{type:i,effectId:e,error:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.effectTriggered=r,n.effectResolved=t,n.effectRejected=u;var o=n.EFFECT_TRIGGERED="EFFECT_TRIGGERED",a=n.EFFECT_RESOLVED="EFFECT_RESOLVED",i=n.EFFECT_REJECTED="EFFECT_REJECTED"},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}function u(e){if(e[d])return e[d];var n=(0,s.default)(),r=e.dispatch;return e.dispatch=function(e){var t=r(e);return n.emit(e),t},e[d]={subscribe:n.subscribe,dispatch:e.dispatch},e[d]}function o(e,n){var r=n.subscribe,t=n.dispatch,u=arguments.length<=2||void 0===arguments[2]?a.noop:arguments[2];return(0,a.check)(e,a.is.iterator,l),(0,c.default)(e,r,t,u)}Object.defineProperty(n,"__esModule",{value:!0}),n.NOT_ITERATOR_ERROR=void 0,n.storeIO=u,n.runSaga=o;var a=r(1),i=r(2),c=t(i),f=r(3),s=t(f),l=n.NOT_ITERATOR_ERROR="runSaga must be called on an iterator",d=Symbol("IO")}])});

@@ -6,3 +6,3 @@ 'use strict';

});
exports.storeIO = exports.runSaga = exports.as = exports.cancel = exports.join = exports.fork = exports.cps = exports.call = exports.race = exports.put = exports.take = exports.MANUAL_CANCEL = exports.PARALLEL_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = exports.SagaCancellationException = undefined;
exports.storeIO = exports.runSaga = exports.as = exports.cancel = exports.join = exports.fork = exports.cps = exports.apply = exports.call = exports.race = exports.put = exports.take = exports.MANUAL_CANCEL = exports.PARALLEL_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = exports.SagaCancellationException = undefined;

@@ -62,2 +62,8 @@ var _proc = require('./proc');

});
Object.defineProperty(exports, 'apply', {
enumerable: true,
get: function get() {
return _io.apply;
}
});
Object.defineProperty(exports, 'cps', {

@@ -64,0 +70,0 @@ enumerable: true,

{
"name": "redux-saga",
"version": "0.4.0",
"version": "0.4.1",
"description": "Saga middleware for Redux to handle Side Effects",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -46,2 +46,3 @@ # redux-saga

- [Task cancellation](#task-cancellation)
- [Dynamically starting Sagas with runSaga](#dynamically-starting-sagas-with-runsaga)
- [Building examples from sources](#building-examples-from-sources)

@@ -223,3 +224,9 @@ - [Using umd build in the browser](#using-umd-build-in-the-browser)

The `call` method is well suited for functions that return Promise results. Another function
Besides `call`, the `apply` effect allows you to provide a `this` context to the invoked functions
```javascript
yield apply(context, myfunc, [arg1, arg2, ...])
```
`call` and `apply` are well suited for functions that return Promise results. Another function
`cps` can be used to handle Node style functions (e.g. `fn(...args, callback)` where `callback`

@@ -664,2 +671,64 @@ is of the form `(error, result) => ()`). For example

#Dynamically starting Sagas with runSaga
The `runSaga` function allows starting sagas outside the Redux middleware environment. It also
allows you to hook up to external input/output, other than store actions.
For example, you can start a Saga on the server using
```javascript
import serverSaga from 'somewhere'
import {runSaga, storeIO} from 'reduc-saga'
import configureStore from 'somewhere'
import rootReducer from 'somewhere'
const store = createStore(rootReducer)
runSaga(
serverSaga(store.getState),
storeIO(store)
).done.then(...)
```
Besides taking and dispatching actions to the store `runSaga` can also be connected to
other input/output sources. This allows you to exploit all the features of sagas to implement
control flows outside Redux.
The method has the following signature
```javascript
runSaga(iterator, {subscribe, dispatch}, [monitor])
```
Arguments
- `iterator: {next, throw}` : an iterator object, Typically created by invoking a Generator function
- `subscribe(callback) => unsubscribe`: i.e. a function which accepts a callback and returns an unsubscribe function
- `callback(action)` : callback (provided by runSaga) used to subscribe to input events. `subscribe` must
support registering multiple subscriptions
- `unsubscribe()` : used by `runSaga` to unsubscribe from the input source once it
has completed (either by normal return or thrown exception)
- `dispatch(action) => result`: used to fulfill `put` effects. Each time a `yield put(action)` is issued, `dispatch`
is invoked with `action`. The return value of `dispatch` is used to fulfill the `put` effect. Promise results
are automatically resolved/rejected.
- `monitor(sagaAction)` (optional): a callback which is used to dispatch all Saga related events. In the middleware
version, all actions are dispatched to the Redux store. See the [sagaMonitor example]
(https://github.com/yelouafi/redux-saga/blob/master/examples/sagaMonitor.js) for usage.
The `subscribe` argument is used to fulfill `take(action)` effects. Each time `subscribe` emits an action
to its callbacks, all sagas blocked on `take(PATTERN)`. And whose take pattern matches the currently incoming action
are resumed with that action.
The matching works as follows
- If `PATTERN` is undefined or '*'. All actions are matched
- If `PATTERN` is a function, the action is matched if `PATTERN(action)` is true
- If `PATTERN` is a string, the action is matched if `action.type === PATTERN`
- If `PATTERN` is an array, `action.type` is matched against all items in the array.
#Building examples from sources

@@ -666,0 +735,0 @@

@@ -11,3 +11,3 @@ import middleware from './middleware'

export { take, put, race, call, cps, fork, join, cancel, as } from './io'
export { take, put, race, call, apply, cps, fork, join, cancel, as } from './io'
export { runSaga, storeIO } from './runSaga'
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