redux-awaiter
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -40,7 +40,5 @@ (function (global, factory) { | ||
this.awaiters = this.awaiters.concat([awaiter]); | ||
return this.awaiters.length; | ||
}; | ||
Awaiters.prototype.consume = function (action) { | ||
this.awaiters = this.awaiters.filter(Awaiters.consumer(action)); | ||
return this.awaiters.length; | ||
}; | ||
@@ -47,0 +45,0 @@ Awaiters.instance = new Awaiters(); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxAwaiter={})}(this,function(e){"use strict";var t=function(){function e(){this.awaiters=[]}return Object.defineProperty(e,"Instance",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e.consumer=function(e){return function(t){var n=t.pattern,r=t.resolve,i=function(e,t){var n=e.type;return"string"==typeof t?n===t:t instanceof RegExp?t.test(n):"function"==typeof t&&t(e)}(e,n);return i&&r(e),!i}},e.prototype.produce=function(e){return this.awaiters=this.awaiters.concat([e]),this.awaiters.length},e.prototype.consume=function(t){return this.awaiters=this.awaiters.filter(e.consumer(t)),this.awaiters.length},e.instance=new e,e}().Instance,n=function(e){return new Promise(function(n){return t.produce({pattern:e,resolve:n})})};e.createAwaiterMiddleware=function(){return function(){return function(e){return function(n){return t.consume(n),e(n)}}}},e.take=n,e.takeAllOf=function(e){return Promise.all(e.map(n))},e.takeOneOf=function(e){return Promise.race(e.map(n))},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxAwaiter={})}(this,function(e){"use strict";var t=function(){function e(){this.awaiters=[]}return Object.defineProperty(e,"Instance",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e.consumer=function(e){return function(t){var n=t.pattern,r=t.resolve,i=function(e,t){var n=e.type;return"string"==typeof t?n===t:t instanceof RegExp?t.test(n):"function"==typeof t&&t(e)}(e,n);return i&&r(e),!i}},e.prototype.produce=function(e){this.awaiters=this.awaiters.concat([e])},e.prototype.consume=function(t){this.awaiters=this.awaiters.filter(e.consumer(t))},e.instance=new e,e}().Instance,n=function(e){return new Promise(function(n){return t.produce({pattern:e,resolve:n})})};e.createAwaiterMiddleware=function(){return function(){return function(e){return function(n){return t.consume(n),e(n)}}}},e.take=n,e.takeAllOf=function(e){return Promise.all(e.map(n))},e.takeOneOf=function(e){return Promise.race(e.map(n))},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -8,6 +8,6 @@ import { Action, Awaiter } from '../types'; | ||
private constructor(); | ||
produce<P = {}, M = {}>(awaiter: Awaiter<P, M>): number; | ||
consume<P = {}, M = {}>(action: Action<P, M>): number; | ||
produce<P = {}, M = {}>(awaiter: Awaiter<P, M>): void; | ||
consume<P = {}, M = {}>(action: Action<P, M>): void; | ||
} | ||
declare const awaiters: Awaiters; | ||
export default awaiters; |
@@ -35,7 +35,5 @@ "use strict"; | ||
this.awaiters = this.awaiters.concat([awaiter]); | ||
return this.awaiters.length; | ||
}; | ||
Awaiters.prototype.consume = function (action) { | ||
this.awaiters = this.awaiters.filter(Awaiters.consumer(action)); | ||
return this.awaiters.length; | ||
}; | ||
@@ -42,0 +40,0 @@ Awaiters.instance = new Awaiters(); |
@@ -36,7 +36,5 @@ "use strict"; | ||
this.awaiters = this.awaiters.concat([awaiter]); | ||
return this.awaiters.length; | ||
}; | ||
Awaiters.prototype.consume = function (action) { | ||
this.awaiters = this.awaiters.filter(Awaiters.consumer(action)); | ||
return this.awaiters.length; | ||
}; | ||
@@ -43,0 +41,0 @@ Awaiters.instance = new Awaiters(); |
{ | ||
"name": "redux-awaiter", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A Redux middleware for giving opportunities to await and receive actions in anywhere", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# Redux Awaiter | ||
Redux Awaiter is a Redux middleware for giving opportunities to await and receive actions in anywhere. | ||
It's tiny (gzip < 1kB, no dependencies). | ||
[![build status](https://img.shields.io/travis/yenshih/redux-awaiter/master.svg?style=flat-square)](https://travis-ci.org/yenshih/redux-awaiter) | ||
@@ -13,3 +15,3 @@ [![Coverage Status](https://img.shields.io/coveralls/yenshih/redux-awaiter/master.svg?style=flat)](https://coveralls.io/github/yenshih/redux-awaiter?branch=master) | ||
Redux Awaiter is designed to await and receive Redux actions in React components and help us manage local state conveniently. | ||
Redux Awaiter is designed to help us manage local state conveniently. | ||
@@ -16,0 +18,0 @@ It's inspired by [Redux Saga](https://github.com/redux-saga/redux-saga/), but the problems they solve are totally different. |
@@ -36,3 +36,2 @@ import { Action, Pattern, Awaiter } from '../types'; | ||
this.awaiters = [...this.awaiters, awaiter]; | ||
return this.awaiters.length; | ||
} | ||
@@ -42,3 +41,2 @@ | ||
this.awaiters = this.awaiters.filter(Awaiters.consumer(action)); | ||
return this.awaiters.length; | ||
} | ||
@@ -45,0 +43,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170
28174
345