redux-awaiter
Advanced tools
Comparing version 0.0.2 to 0.0.3
"use strict"; | ||
export class Awaiters { | ||
constructor() { | ||
var Awaiters = (function () { | ||
function Awaiters() { | ||
this.awaiters = []; | ||
} | ||
static get Instance() { | ||
return this.instance; | ||
} | ||
static consumer(action) { | ||
return ({ pattern, resolve }) => { | ||
const isMatch = ((action, pattern) => { | ||
const { type } = action; | ||
Object.defineProperty(Awaiters, "Instance", { | ||
get: function () { | ||
return this.instance; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Awaiters.consumer = function (action) { | ||
return function (_a) { | ||
var pattern = _a.pattern, resolve = _a.resolve; | ||
var isMatch = (function (action, pattern) { | ||
var type = action.type; | ||
if (typeof pattern === 'string') { | ||
@@ -27,13 +32,15 @@ return type === pattern; | ||
}; | ||
} | ||
produce(awaiter) { | ||
this.awaiters = [...this.awaiters, awaiter]; | ||
} | ||
consume(action) { | ||
}; | ||
Awaiters.prototype.produce = function (awaiter) { | ||
this.awaiters = this.awaiters.concat([awaiter]); | ||
}; | ||
Awaiters.prototype.consume = function (action) { | ||
this.awaiters = this.awaiters.filter(Awaiters.consumer(action)); | ||
} | ||
} | ||
Awaiters.instance = new Awaiters(); | ||
const awaiters = Awaiters.Instance; | ||
}; | ||
Awaiters.instance = new Awaiters(); | ||
return Awaiters; | ||
}()); | ||
export { Awaiters }; | ||
var awaiters = Awaiters.Instance; | ||
export default awaiters; | ||
//# sourceMappingURL=awaiters.js.map |
"use strict"; | ||
import awaiters from './awaiters'; | ||
export const createAwaiterMiddleware = () => () => next => (action) => { | ||
export var createAwaiterMiddleware = function () { return function () { return function (next) { return function (action) { | ||
awaiters.consume(action); | ||
return next(action); | ||
}; | ||
}; }; }; }; | ||
export * from './awaiters'; | ||
export * from './operations'; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
import awaiters from '../awaiters'; | ||
export const take = (pattern) => new Promise(resolve => awaiters.produce({ pattern, resolve })); | ||
export var take = function (pattern) { | ||
return new Promise(function (resolve) { return awaiters.produce({ pattern: pattern, resolve: resolve }); }); | ||
}; | ||
//# sourceMappingURL=take.js.map |
"use strict"; | ||
import { take } from './'; | ||
export const takeAllOf = (patterns) => Promise.all(patterns.map(take)); | ||
export var takeAllOf = function (patterns) { | ||
return Promise.all(patterns.map(take)); | ||
}; | ||
//# sourceMappingURL=takeAllOf.js.map |
"use strict"; | ||
import { take } from './'; | ||
export const takeOneOf = (patterns) => Promise.race(patterns.map(take)); | ||
export var takeOneOf = function (patterns) { | ||
return Promise.race(patterns.map(take)); | ||
}; | ||
//# sourceMappingURL=takeOneOf.js.map |
{ | ||
"name": "redux-awaiter", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A Redux middleware for giving opportunities to await and receive actions in anywhere", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
"build:es": "tsc --outDir es -d", | ||
"build:commonjs": "tsc -m commonjs --target es5 --outDir lib", | ||
"build:commonjs": "tsc -m commonjs --outDir lib", | ||
"build": "npm run build:es && npm run build:commonjs", | ||
@@ -24,0 +24,0 @@ "prepare": "npm run clean && npm run lint && npm run build" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
22153
264