tempo-store
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -5,2 +5,28 @@ { | ||
{ | ||
"version": "1.2.0", | ||
"tag": "tempo-store_v1.2.0", | ||
"date": "Sat, 15 Feb 2020 20:16:59 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Change signature of `Store.observable` to expose the previous state along with the new one" | ||
}, | ||
{ | ||
"comment": "Remove `index` file (imports must point specific modules)" | ||
}, | ||
{ | ||
"comment": "Increase number of arguments for `Emitter` and `Observable` up to 6" | ||
} | ||
], | ||
"dependency": [ | ||
{ | ||
"comment": "Updating dependency \"tempo-core\" from `1.6.0` to `1.7.0`" | ||
}, | ||
{ | ||
"comment": "Updating dependency \"tempo-std\" from `0.2.0` to `0.3.0`" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "1.1.2", | ||
@@ -7,0 +33,0 @@ "tag": "tempo-store_v1.1.2", |
# Change Log - tempo-store | ||
This log was last generated on Sat, 18 Jan 2020 05:08:11 GMT and should not be manually modified. | ||
This log was last generated on Sat, 15 Feb 2020 20:16:59 GMT and should not be manually modified. | ||
## 1.2.0 | ||
Sat, 15 Feb 2020 20:16:59 GMT | ||
### Minor changes | ||
- Change signature of `Store.observable` to expose the previous state along with the new one | ||
- Remove `index` file (imports must point specific modules) | ||
- Increase number of arguments for `Emitter` and `Observable` up to 6 | ||
## 1.1.2 | ||
@@ -6,0 +15,0 @@ Sat, 18 Jan 2020 05:08:11 GMT |
@@ -7,2 +7,5 @@ import { Listener } from './listener'; | ||
static ofThree<A, B, C>(): Emitter3<A, B, C>; | ||
static ofFour<A, B, C, D>(): Emitter4<A, B, C, D>; | ||
static ofFive<A, B, C, D, E>(): Emitter5<A, B, C, D, E>; | ||
static ofSix<A, B, C, D, E, F>(): Emitter6<A, B, C, D, E, F>; | ||
readonly listeners: Listener<T>[]; | ||
@@ -18,4 +21,7 @@ private constructor(); | ||
export declare type Emitter3<A, B, C> = Emitter<[A, B, C]>; | ||
export declare const debounce: (delay: number) => <T extends any[]>(listener: Listener<T>) => Listener<T>; | ||
export declare const nextFrame: <T extends any[]>(listener: Listener<T>) => Listener<T>; | ||
export declare type Emitter4<A, B, C, D> = Emitter<[A, B, C, D]>; | ||
export declare type Emitter5<A, B, C, D, E> = Emitter<[A, B, C, D, E]>; | ||
export declare type Emitter6<A, B, C, D, E, F> = Emitter<[A, B, C, D, E, F]>; | ||
export declare function debounce(delay: number): <T extends any[]>(listener: Listener<T>) => Listener<T>; | ||
export declare function nextFrame<T extends any[]>(listener: Listener<T>): Listener<T>; | ||
//# sourceMappingURL=emitter.d.ts.map |
@@ -26,2 +26,11 @@ /* | ||
}; | ||
Emitter.ofFour = function () { | ||
return new Emitter(); | ||
}; | ||
Emitter.ofFive = function () { | ||
return new Emitter(); | ||
}; | ||
Emitter.ofSix = function () { | ||
return new Emitter(); | ||
}; | ||
Emitter.prototype.emit = function () { | ||
@@ -62,21 +71,23 @@ var value = []; | ||
export { Emitter }; | ||
export var debounce = function (delay) { return function (listener) { | ||
var running = false; | ||
var acc; | ||
return function () { | ||
var values = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
values[_i] = arguments[_i]; | ||
} | ||
acc = values; | ||
if (running) | ||
return; | ||
running = true; | ||
setTimeout(function () { | ||
running = false; | ||
listener.apply(void 0, acc); | ||
}, delay); | ||
export function debounce(delay) { | ||
return function (listener) { | ||
var running = false; | ||
var acc; | ||
return function () { | ||
var values = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
values[_i] = arguments[_i]; | ||
} | ||
acc = values; | ||
if (running) | ||
return; | ||
running = true; | ||
setTimeout(function () { | ||
running = false; | ||
listener.apply(void 0, acc); | ||
}, delay); | ||
}; | ||
}; | ||
}; }; | ||
export var nextFrame = function (listener) { | ||
} | ||
export function nextFrame(listener) { | ||
var running = false; | ||
@@ -98,3 +109,3 @@ var acc; | ||
}; | ||
}; | ||
} | ||
//# sourceMappingURL=emitter.js.map |
@@ -10,2 +10,5 @@ import { Listener } from './listener'; | ||
export declare type Observable3<A, B, C> = Observable<[A, B, C]>; | ||
export declare type Observable4<A, B, C, D> = Observable<[A, B, C, D]>; | ||
export declare type Observable5<A, B, C, D, E> = Observable<[A, B, C, D, E]>; | ||
export declare type Observable6<A, B, C, D, E, F> = Observable<[A, B, C, D, E, F]>; | ||
//# sourceMappingURL=observable.d.ts.map |
@@ -14,4 +14,3 @@ /* | ||
import { Emitter } from './emitter'; | ||
import { strictEqual } from './equality'; | ||
// @ts-ignore | ||
import { strictEqual } from 'tempo-std/lib/equals'; | ||
var Property = /** @class */ (function () { | ||
@@ -18,0 +17,0 @@ function Property(value, equal) { |
export declare type Reducer<State, Action> = (state: State, action: Action) => State; | ||
export declare const compose: <State, Action>(reducer: Reducer<State, Action>, ...others: Reducer<State, Action>[]) => (state: State, action: Action) => State; | ||
export declare const matchReduce: <Field extends string | number | symbol, State, Action extends { [_ in Field]: any; }>(field: Field, matches: { [k in Action[Field]]: (state: State, action: Action extends { [__1 in Field]: k; } ? Action : never) => State; }) => Reducer<State, Action>; | ||
export declare const reduceOnKind: <State, Action extends { | ||
export declare function compose<State, Action>(reducer: Reducer<State, Action>, ...others: Reducer<State, Action>[]): (state: State, action: Action) => State; | ||
export declare function matchReduce<Field extends string | number | symbol, State, Action extends { | ||
[_ in Field]: any; | ||
}>(field: Field, matches: { | ||
[k in Action[Field]]: (state: State, action: Action extends { | ||
[_ in Field]: k; | ||
} ? Action : never) => State; | ||
}): Reducer<State, Action>; | ||
export declare function reduceOnKind<State, Action extends { | ||
kind: any; | ||
}>(matches: { [k in Action["kind"]]: (state: State, action: Action extends { | ||
kind: k; | ||
} ? Action : never) => State; }) => Reducer<State, Action>; | ||
}>(matches: { | ||
[k in Action['kind']]: (state: State, action: Action extends { | ||
kind: k; | ||
} ? Action : never) => State; | ||
}): Reducer<State, Action>; | ||
//# sourceMappingURL=reducer.d.ts.map |
@@ -13,3 +13,3 @@ /* | ||
*/ | ||
export var compose = function (reducer) { | ||
export function compose(reducer) { | ||
var others = []; | ||
@@ -22,4 +22,4 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
}; | ||
}; | ||
export var matchReduce = function (field, matches) { | ||
} | ||
export function matchReduce(field, matches) { | ||
return function (state, action) { | ||
@@ -29,4 +29,4 @@ var key = action[field]; | ||
}; | ||
}; | ||
export var reduceOnKind = function (matches) { | ||
} | ||
export function reduceOnKind(matches) { | ||
return function (state, action) { | ||
@@ -36,3 +36,3 @@ var key = action.kind; | ||
}; | ||
}; | ||
} | ||
//# sourceMappingURL=reducer.js.map |
import { Property } from './property'; | ||
import { Reducer } from './reducer'; | ||
import { Observable3 } from './observable'; | ||
import { Observable4 } from './observable'; | ||
export declare class Store<State, Action> { | ||
@@ -12,3 +12,3 @@ readonly property: Property<State>; | ||
}): Store<State, Action>; | ||
readonly observable: Observable3<State, Action, boolean>; | ||
readonly observable: Observable4<State, Action, State, boolean>; | ||
constructor(property: Property<State>, reducer: Reducer<State, Action>); | ||
@@ -15,0 +15,0 @@ process(action: Action): boolean; |
@@ -19,3 +19,3 @@ /* | ||
this.reducer = reducer; | ||
this.observable = this.emitter = Emitter.ofThree(); | ||
this.observable = this.emitter = Emitter.ofFour(); | ||
} | ||
@@ -26,5 +26,6 @@ Store.ofState = function (options) { | ||
Store.prototype.process = function (action) { | ||
var value = this.reducer(this.property.get(), action); | ||
var curr = this.property.get(); | ||
var value = this.reducer(curr, action); | ||
var result = this.property.set(value); | ||
this.emitter.emit(value, action, result); | ||
this.emitter.emit(value, action, curr, result); | ||
return result; | ||
@@ -31,0 +32,0 @@ }; |
@@ -7,2 +7,5 @@ import { Listener } from './listener'; | ||
static ofThree<A, B, C>(): Emitter3<A, B, C>; | ||
static ofFour<A, B, C, D>(): Emitter4<A, B, C, D>; | ||
static ofFive<A, B, C, D, E>(): Emitter5<A, B, C, D, E>; | ||
static ofSix<A, B, C, D, E, F>(): Emitter6<A, B, C, D, E, F>; | ||
readonly listeners: Listener<T>[]; | ||
@@ -18,4 +21,7 @@ private constructor(); | ||
export declare type Emitter3<A, B, C> = Emitter<[A, B, C]>; | ||
export declare const debounce: (delay: number) => <T extends any[]>(listener: Listener<T>) => Listener<T>; | ||
export declare const nextFrame: <T extends any[]>(listener: Listener<T>) => Listener<T>; | ||
export declare type Emitter4<A, B, C, D> = Emitter<[A, B, C, D]>; | ||
export declare type Emitter5<A, B, C, D, E> = Emitter<[A, B, C, D, E]>; | ||
export declare type Emitter6<A, B, C, D, E, F> = Emitter<[A, B, C, D, E, F]>; | ||
export declare function debounce(delay: number): <T extends any[]>(listener: Listener<T>) => Listener<T>; | ||
export declare function nextFrame<T extends any[]>(listener: Listener<T>): Listener<T>; | ||
//# sourceMappingURL=emitter.d.ts.map |
@@ -28,2 +28,11 @@ "use strict"; | ||
}; | ||
Emitter.ofFour = function () { | ||
return new Emitter(); | ||
}; | ||
Emitter.ofFive = function () { | ||
return new Emitter(); | ||
}; | ||
Emitter.ofSix = function () { | ||
return new Emitter(); | ||
}; | ||
Emitter.prototype.emit = function () { | ||
@@ -64,21 +73,24 @@ var value = []; | ||
exports.Emitter = Emitter; | ||
exports.debounce = function (delay) { return function (listener) { | ||
var running = false; | ||
var acc; | ||
return function () { | ||
var values = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
values[_i] = arguments[_i]; | ||
} | ||
acc = values; | ||
if (running) | ||
return; | ||
running = true; | ||
setTimeout(function () { | ||
running = false; | ||
listener.apply(void 0, acc); | ||
}, delay); | ||
function debounce(delay) { | ||
return function (listener) { | ||
var running = false; | ||
var acc; | ||
return function () { | ||
var values = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
values[_i] = arguments[_i]; | ||
} | ||
acc = values; | ||
if (running) | ||
return; | ||
running = true; | ||
setTimeout(function () { | ||
running = false; | ||
listener.apply(void 0, acc); | ||
}, delay); | ||
}; | ||
}; | ||
}; }; | ||
exports.nextFrame = function (listener) { | ||
} | ||
exports.debounce = debounce; | ||
function nextFrame(listener) { | ||
var running = false; | ||
@@ -100,3 +112,4 @@ var acc; | ||
}; | ||
}; | ||
} | ||
exports.nextFrame = nextFrame; | ||
//# sourceMappingURL=emitter.js.map |
@@ -10,2 +10,5 @@ import { Listener } from './listener'; | ||
export declare type Observable3<A, B, C> = Observable<[A, B, C]>; | ||
export declare type Observable4<A, B, C, D> = Observable<[A, B, C, D]>; | ||
export declare type Observable5<A, B, C, D, E> = Observable<[A, B, C, D, E]>; | ||
export declare type Observable6<A, B, C, D, E, F> = Observable<[A, B, C, D, E, F]>; | ||
//# sourceMappingURL=observable.d.ts.map |
@@ -16,7 +16,6 @@ "use strict"; | ||
var emitter_1 = require("./emitter"); | ||
var equality_1 = require("./equality"); | ||
// @ts-ignore | ||
var equals_1 = require("tempo-std/lib/equals"); | ||
var Property = /** @class */ (function () { | ||
function Property(value, equal) { | ||
if (equal === void 0) { equal = equality_1.strictEqual; } | ||
if (equal === void 0) { equal = equals_1.strictEqual; } | ||
this.value = value; | ||
@@ -23,0 +22,0 @@ this.equal = equal; |
export declare type Reducer<State, Action> = (state: State, action: Action) => State; | ||
export declare const compose: <State, Action>(reducer: Reducer<State, Action>, ...others: Reducer<State, Action>[]) => (state: State, action: Action) => State; | ||
export declare const matchReduce: <Field extends string | number | symbol, State, Action extends { [_ in Field]: any; }>(field: Field, matches: { [k in Action[Field]]: (state: State, action: Action extends { [__1 in Field]: k; } ? Action : never) => State; }) => Reducer<State, Action>; | ||
export declare const reduceOnKind: <State, Action extends { | ||
export declare function compose<State, Action>(reducer: Reducer<State, Action>, ...others: Reducer<State, Action>[]): (state: State, action: Action) => State; | ||
export declare function matchReduce<Field extends string | number | symbol, State, Action extends { | ||
[_ in Field]: any; | ||
}>(field: Field, matches: { | ||
[k in Action[Field]]: (state: State, action: Action extends { | ||
[_ in Field]: k; | ||
} ? Action : never) => State; | ||
}): Reducer<State, Action>; | ||
export declare function reduceOnKind<State, Action extends { | ||
kind: any; | ||
}>(matches: { [k in Action["kind"]]: (state: State, action: Action extends { | ||
kind: k; | ||
} ? Action : never) => State; }) => Reducer<State, Action>; | ||
}>(matches: { | ||
[k in Action['kind']]: (state: State, action: Action extends { | ||
kind: k; | ||
} ? Action : never) => State; | ||
}): Reducer<State, Action>; | ||
//# sourceMappingURL=reducer.d.ts.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.compose = function (reducer) { | ||
function compose(reducer) { | ||
var others = []; | ||
@@ -24,4 +24,5 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
}; | ||
}; | ||
exports.matchReduce = function (field, matches) { | ||
} | ||
exports.compose = compose; | ||
function matchReduce(field, matches) { | ||
return function (state, action) { | ||
@@ -31,4 +32,5 @@ var key = action[field]; | ||
}; | ||
}; | ||
exports.reduceOnKind = function (matches) { | ||
} | ||
exports.matchReduce = matchReduce; | ||
function reduceOnKind(matches) { | ||
return function (state, action) { | ||
@@ -38,3 +40,4 @@ var key = action.kind; | ||
}; | ||
}; | ||
} | ||
exports.reduceOnKind = reduceOnKind; | ||
//# sourceMappingURL=reducer.js.map |
import { Property } from './property'; | ||
import { Reducer } from './reducer'; | ||
import { Observable3 } from './observable'; | ||
import { Observable4 } from './observable'; | ||
export declare class Store<State, Action> { | ||
@@ -12,3 +12,3 @@ readonly property: Property<State>; | ||
}): Store<State, Action>; | ||
readonly observable: Observable3<State, Action, boolean>; | ||
readonly observable: Observable4<State, Action, State, boolean>; | ||
constructor(property: Property<State>, reducer: Reducer<State, Action>); | ||
@@ -15,0 +15,0 @@ process(action: Action): boolean; |
@@ -21,3 +21,3 @@ "use strict"; | ||
this.reducer = reducer; | ||
this.observable = this.emitter = emitter_1.Emitter.ofThree(); | ||
this.observable = this.emitter = emitter_1.Emitter.ofFour(); | ||
} | ||
@@ -28,5 +28,6 @@ Store.ofState = function (options) { | ||
Store.prototype.process = function (action) { | ||
var value = this.reducer(this.property.get(), action); | ||
var curr = this.property.get(); | ||
var value = this.reducer(curr, action); | ||
var result = this.property.set(value); | ||
this.emitter.emit(value, action, result); | ||
this.emitter.emit(value, action, curr, result); | ||
return result; | ||
@@ -33,0 +34,0 @@ }; |
{ | ||
"name": "tempo-store", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"priority": 20, | ||
"description": "Super simple state management library", | ||
@@ -37,11 +38,12 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"tempo-core": "1.6.0" | ||
"tempo-core": "1.7.0", | ||
"tempo-std": "0.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "24.0.22", | ||
"jest": "24.9.0", | ||
"@types/jest": "25.1.2", | ||
"jest": "25.1.0", | ||
"prettier": "1.19.1", | ||
"ts-jest": "24.1.0", | ||
"tslint": "5.20.1", | ||
"typescript": "3.7.2" | ||
"ts-jest": "25.2.0", | ||
"tslint": "6.0.0", | ||
"typescript": "3.7.5" | ||
}, | ||
@@ -48,0 +50,0 @@ "main": "lib/index.js", |
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
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
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
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
50594
2
52
719
+ Addedtempo-std@0.3.0
+ Addedtempo-core@1.7.0(transitive)
+ Addedtempo-std@0.3.0(transitive)
- Removedtempo-core@1.6.0(transitive)
Updatedtempo-core@1.7.0