compiling project
This commit is contained in:
parent
da7ac2ef6e
commit
1379055264
2
dist/buildMutations/index.d.ts
vendored
2
dist/buildMutations/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
/// <reference types="lodash" />
|
||||
import { Mutation, Action, Dictionary } from '../types';
|
||||
declare function buildMutations(mutations?: Dictionary<Mutation>, subduxes?: {}): import("lodash").Dictionary<Mutation<any, Action<string, any>>>;
|
||||
declare function buildMutations(mutations?: Dictionary<Mutation | ([Mutation, boolean | undefined])>, subduxes?: {}): import("lodash").Dictionary<Mutation<any, Action<string, any>>>;
|
||||
export default buildMutations;
|
||||
//# sourceMappingURL=index.d.ts.map
|
2
dist/buildMutations/index.d.ts.map
vendored
2
dist/buildMutations/index.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/buildMutations/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAWtD,iBAAS,cAAc,CACnB,SAAS,GAAE,UAAU,CAAC,QAAQ,CAAM,EACpC,QAAQ,KAAK,mEAgDhB;AAED,eAAe,cAAc,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/buildMutations/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAWtD,iBAAS,cAAc,CACnB,SAAS,GAAE,UAAU,CAAC,QAAQ,GAAC,CAAC,CAAC,QAAQ,EAAC,OAAO,GAAC,SAAS,CAAC,CAAC,CAAM,EACnE,QAAQ,KAAK,mEAyDhB;AAED,eAAe,cAAc,CAAC"}
|
16
dist/buildMutations/index.js
vendored
16
dist/buildMutations/index.js
vendored
@ -20,12 +20,24 @@ function buildMutations(mutations = {}, subduxes = {}) {
|
||||
});
|
||||
nonGlobby.forEach(([slice, { mutations = {}, reducer = {} }]) => {
|
||||
Object.entries(mutations).forEach(([type, mutation]) => {
|
||||
const localized = (payload = null, action) => updeep_1.default.updateIn(slice)(mutation(payload, action));
|
||||
const localized = (payload = null, action) => {
|
||||
return updeep_1.default.updateIn(slice)(mutation(payload, action));
|
||||
};
|
||||
mergedMutations[type].push(localized);
|
||||
});
|
||||
});
|
||||
Object.entries(mutations).forEach(([type, mutation]) => {
|
||||
mergedMutations[type].push(mutation);
|
||||
if (Array.isArray(mutation)) {
|
||||
if (mutation[1]) {
|
||||
mergedMutations[type] = [
|
||||
mutation[0]
|
||||
];
|
||||
}
|
||||
else
|
||||
mergedMutations[type].push(mutation[0]);
|
||||
}
|
||||
else
|
||||
mergedMutations[type].push(mutation);
|
||||
});
|
||||
return fp_1.default.mapValues(composeMutations)(mergedMutations);
|
||||
}
|
||||
|
2
dist/buildMutations/index.js.map
vendored
2
dist/buildMutations/index.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/buildMutations/index.ts"],"names":[],"mappings":";;;;;AAAA,mDAA2B;AAC3B,oDAAuB;AAGvB,MAAM,gBAAgB,GAAG,CAAC,SAAqB,EAAE,EAAE,CACjD,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,UAAe,IAAI,EAAE,MAAc,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAC5E,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAChD,CAAC;AAMJ,SAAS,cAAc,CACnB,YAAkC,EAAE,EACpC,QAAQ,GAAG,EAAE;IAKf,MAAM,OAAO,GAAG,YAAE,CAAC,IAAI,CACrB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC3B,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,SAAS,GAAG,EAA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EAAE,EAAE;YACrD,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,IAAI,EAAE,MAAc,EAAE,EAAE;gBACnD,OAAO,gBAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAE,QAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YACpE,CAAC,CAAA;YAED,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE;QACrD,IAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAG;YAC3B,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAG;gBACd,eAAe,CAAC,IAAI,CAAC,GAAG;oBACpB,QAAQ,CAAC,CAAC,CAAC;iBACd,CAAA;aACJ;;gBACI,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAE,QAAQ,CAAC,CAAC,CAAC,CAAE,CAAC;SAClD;;YACI,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,OAAO,YAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,eAAe,CAAC,CAAC;AACzD,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
2
dist/mappedUpdux.test.d.ts
vendored
Normal file
2
dist/mappedUpdux.test.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=mappedUpdux.test.d.ts.map
|
1
dist/mappedUpdux.test.d.ts.map
vendored
Normal file
1
dist/mappedUpdux.test.d.ts.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"mappedUpdux.test.d.ts","sourceRoot":"","sources":["../src/mappedUpdux.test.ts"],"names":[],"mappings":""}
|
28
dist/mappedUpdux.test.js
vendored
Normal file
28
dist/mappedUpdux.test.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const updux_1 = __importDefault(require("./updux"));
|
||||
const updeep_1 = __importDefault(require("updeep"));
|
||||
const todo = new updux_1.default({
|
||||
mutations: {
|
||||
review: () => updeep_1.default({ reviewed: true }),
|
||||
done: () => updeep_1.default({ done: true }),
|
||||
},
|
||||
});
|
||||
const todos = new updux_1.default({
|
||||
subduxes: { '*': todo },
|
||||
});
|
||||
todos.addMutation(todo.actions.done, (id, action) => updeep_1.default.map(updeep_1.default.if(updeep_1.default.is('id', id), todo.upreducer(action))), true);
|
||||
test('* for mapping works', () => {
|
||||
const reducer = todos.reducer;
|
||||
let state = [{ id: 0 }, { id: 1 }];
|
||||
state = reducer(state, todos.actions.review());
|
||||
state = reducer(state, todos.actions.done(1));
|
||||
expect(state).toEqual([
|
||||
{ id: 0, reviewed: true },
|
||||
{ id: 1, reviewed: true, done: true },
|
||||
]);
|
||||
});
|
||||
//# sourceMappingURL=mappedUpdux.test.js.map
|
1
dist/mappedUpdux.test.js.map
vendored
Normal file
1
dist/mappedUpdux.test.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"mappedUpdux.test.js","sourceRoot":"","sources":["../src/mappedUpdux.test.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,oDAAuB;AAEvB,MAAM,IAAI,GAAG,IAAI,eAAK,CAAC;IACnB,SAAS,EAAE;QACP,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;QAClC,IAAI,EAAE,GAAG,EAAE,CAAC,gBAAC,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;KA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vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"sink.test.d.ts","sourceRoot":"","sources":["../src/sink.test.ts"],"names":[],"mappings":""}
|
46
dist/sink.test.js
vendored
Normal file
46
dist/sink.test.js
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const updux_1 = __importDefault(require("./updux"));
|
||||
const foo = new updux_1.default({
|
||||
initial: 0,
|
||||
mutations: {
|
||||
doIt: () => (state) => {
|
||||
return state + 1;
|
||||
},
|
||||
doTheThing: () => (state) => {
|
||||
return state + 3;
|
||||
},
|
||||
},
|
||||
});
|
||||
const bar = new updux_1.default({
|
||||
subduxes: { foo },
|
||||
});
|
||||
bar.addMutation(foo.actions.doTheThing, (_, action) => state => {
|
||||
return {
|
||||
...state,
|
||||
baz: bar.subduxUpreducer(action)(state),
|
||||
};
|
||||
}, true);
|
||||
bar.addMutation(foo.actions.doIt, () => (state) => ({ ...state, bar: 'yay' }), true);
|
||||
test('initial', () => {
|
||||
expect(bar.initial).toEqual({ foo: 0 });
|
||||
});
|
||||
test('foo alone', () => {
|
||||
expect(foo.reducer(undefined, foo.actions.doIt())).toEqual(1);
|
||||
});
|
||||
test('sink mutations', () => {
|
||||
expect(bar.reducer(undefined, bar.actions.doIt())).toEqual({
|
||||
foo: 0,
|
||||
bar: 'yay',
|
||||
});
|
||||
});
|
||||
test('sink mutation and subduxUpreducer', () => {
|
||||
expect(bar.reducer(undefined, bar.actions.doTheThing())).toEqual({
|
||||
foo: 0,
|
||||
baz: { foo: 3 },
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=sink.test.js.map
|
1
dist/sink.test.js.map
vendored
Normal file
1
dist/sink.test.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"sink.test.js","sourceRoot":"","sources":["../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AE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC1B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACzD,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,KAAK;KACX,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAC7C,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAC,GAAG,EAAE,CAAC,EAAC;KACd,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
3
dist/updux.d.ts
vendored
3
dist/updux.d.ts
vendored
@ -22,9 +22,10 @@ export declare class Updux<S = any> {
|
||||
readonly upreducer: Upreducer<S>;
|
||||
readonly reducer: (state: S | undefined, action: Action) => S;
|
||||
readonly mutations: Dictionary<Mutation<S>>;
|
||||
readonly subduxUpreducer: Upreducer<any>;
|
||||
readonly createStore: () => StoreWithDispatchActions<S>;
|
||||
readonly asDux: Dux<S>;
|
||||
addMutation<A extends ActionCreator>(creator: A, mutation: Mutation<S, A extends (...args: any[]) => infer R ? R : never>): void;
|
||||
addMutation<A extends ActionCreator>(creator: A, mutation: Mutation<S, A extends (...args: any[]) => infer R ? R : never>, isSink?: boolean): void;
|
||||
}
|
||||
export default Updux;
|
||||
//# sourceMappingURL=updux.d.ts.map
|
2
dist/updux.d.ts.map
vendored
2
dist/updux.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"updux.d.ts","sourceRoot":"","sources":["../src/updux.ts"],"names":[],"mappings":"AAWA,OAAO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F,qBAAa,KAAK,CAAC,CAAC,GAAG,GAAG;IACxB,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAS5B,OAAO,EAAE,CAAC,CAAC;IAqCX,cAAc,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE3C,OAAO,CAAC,YAAY,CAE9B;IAEU,OAAO,CAAC,YAAY,CAA4B;IAEhD,OAAO,CAAC,cAAc,CAEhC;gBAEU,MAAM,GAAE,WAAgB;aA0BtB,UAAU,EAAI,UAAU,CAAC,EAAE,EAAE,CAAC,EAAE,aAAa,CAAC;aAsB9C,OAAO,EAAI,UAAU,CAAC,aAAa,CAAC;aAYpC,SAAS,EAAI,SAAS,CAAC,CAAC,CAAC;aAQzB,OAAO,EAAI,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;aAStD,SAAS,EAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aAqBpC,eAAe;aA6Bf,WAAW,EAAI,MAAM,wBAAwB,CAAC,CAAC,CAAC;aAiB1D,KAAK,EAAI,GAAG,CAAC,CAAC,CAAC;IAyBnB,WAAW,CAAC,CAAC,SAAS,aAAa,EACjC,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,EACxE,MAAM,CAAC,EAAE,OAAO;CAQnB;AAED,eAAe,KAAK,CAAC"}
|
13
dist/updux.js
vendored
13
dist/updux.js
vendored
@ -43,6 +43,9 @@ class Updux {
|
||||
get mutations() {
|
||||
return buildMutations_1.default(this.localMutations, this.subduxes);
|
||||
}
|
||||
get subduxUpreducer() {
|
||||
return buildUpreducer_1.default(this.initial, buildMutations_1.default({}, this.subduxes));
|
||||
}
|
||||
get createStore() {
|
||||
const actions = this.actions;
|
||||
return buildCreateStore_1.default(this.reducer, this.initial, this.middleware, this.actions);
|
||||
@ -59,9 +62,12 @@ class Updux {
|
||||
initial: this.initial,
|
||||
};
|
||||
}
|
||||
addMutation(creator, mutation) {
|
||||
addMutation(creator, mutation, isSink) {
|
||||
this.localActions[creator.type] = creator;
|
||||
this.localMutations[creator.type] = this.groomMutations(mutation);
|
||||
this.localMutations[creator.type] = [
|
||||
this.groomMutations(mutation),
|
||||
isSink,
|
||||
];
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
@ -88,6 +94,9 @@ __decorate([
|
||||
__decorate([
|
||||
mobx_1.computed
|
||||
], Updux.prototype, "mutations", null);
|
||||
__decorate([
|
||||
mobx_1.computed
|
||||
], Updux.prototype, "subduxUpreducer", null);
|
||||
__decorate([
|
||||
mobx_1.computed
|
||||
], Updux.prototype, "createStore", null);
|
||||
|
2
dist/updux.js.map
vendored
2
dist/updux.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"updux.js","sourceRoot":"","sources":["../src/updux.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mDAA2B;AAE3B,+BAAgD;AAEhD,kEAA0C;AAC1C,kEAA0C;AAC1C,sEAA8C;AAE9C,0EAAkD;AAClD,wEAAgD;AAChD,sEAA8C;AAY9C,+CAA6C;AAArC,uCAAA,aAAa,CAAA;AA4BrB,MAAa,KAAK;IAyDhB,YAAY,SAAsB,EAAE;QAClC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC,CAAC,CAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAEvE,IAAI,CAAC,QAAQ,GAAG,YAAE,CAAC,SAAS,CAAC,CAAC,KAA0B,EAAE,EAAE,CAC1D,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CACnD,CAAC,YAA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Q;oCAER;AAOS;IAAT,eAAQ;sCAER;AAmBS;IAAT,eAAQ;4CAER;AA2BS;IAAT,eAAQ;wCASR;AAnMH,sBA+OC;AAED,kBAAe,KAAK,CAAC"}
|
File diff suppressed because one or more lines are too long
@ -124,6 +124,7 @@
|
||||
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="updux.html#middleware" class="tsd-kind-icon">middleware</a></li>
|
||||
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="updux.html#mutations" class="tsd-kind-icon">mutations</a></li>
|
||||
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="updux.html#reducer" class="tsd-kind-icon">reducer</a></li>
|
||||
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="updux.html#subduxupreducer" class="tsd-kind-icon">subdux<wbr>Upreducer</a></li>
|
||||
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="updux.html#upreducer" class="tsd-kind-icon">upreducer</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
@ -148,7 +149,7 @@
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:106</li>
|
||||
<li>Defined in updux.ts:108</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
@ -264,7 +265,7 @@
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:156</li>
|
||||
<li>Defined in updux.ts:158</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -294,7 +295,7 @@ payload,meta})</code> (with the extra sugar that if <code>meta</code> or <code>p
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:231</li>
|
||||
<li>Defined in updux.ts:254</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -319,7 +320,7 @@ payload,meta})</code> (with the extra sugar that if <code>meta</code> or <code>p
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:214</li>
|
||||
<li>Defined in updux.ts:237</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -368,7 +369,7 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:134</li>
|
||||
<li>Defined in updux.ts:136</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -392,7 +393,7 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:185</li>
|
||||
<li>Defined in updux.ts:187</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -416,7 +417,7 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:176</li>
|
||||
<li>Defined in updux.ts:178</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -450,6 +451,78 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
|
||||
<a name="subduxupreducer" class="tsd-anchor"></a>
|
||||
<h3>subdux<wbr>Upreducer</h3>
|
||||
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
|
||||
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> subduxUpreducer<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:208</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p>Returns the upreducer made of the merge of all sudbuxes reducers, without
|
||||
the local mutations. Useful, for example, for sink mutations.</p>
|
||||
</div>
|
||||
<dl class="tsd-comment-tags">
|
||||
<dt>example</dt>
|
||||
<dd><pre><code><span class="hljs-keyword">import</span> todo <span class="hljs-keyword">from</span> <span class="hljs-string">'./todo'</span>; <span class="hljs-comment">// updux for a single todo</span>
|
||||
<span class="hljs-keyword">import</span> Updux <span class="hljs-keyword">from</span> <span class="hljs-string">'updux'</span>;
|
||||
<span class="hljs-keyword">import</span> u <span class="hljs-keyword">from</span> <span class="hljs-string">'updeep'</span>;
|
||||
|
||||
<span class="hljs-keyword">const</span> todos = <span class="hljs-keyword">new</span> Updux({ initial: [], subduxes: { <span class="hljs-string">'*'</span>: todo } });
|
||||
todos.addMutation(
|
||||
todo.actions.done,
|
||||
<span class="hljs-function">(<span class="hljs-params">{todo_id},action</span>) =></span> u.map( u.if( u.is(<span class="hljs-string">'id'</span>,todo_id) ), todos.subduxUpreducer(action) )
|
||||
<span class="hljs-literal">true</span>
|
||||
);</code></pre></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">function</span></h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li class="tsd-parameter-siganture">
|
||||
<ul class="tsd-signatures tsd-kind-type-literal">
|
||||
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>action<span class="tsd-signature-symbol">: </span><a href="../globals.html#action" class="tsd-signature-type">Action</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li>
|
||||
<h5>action: <a href="../globals.html#action" class="tsd-signature-type">Action</a></h5>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">function</span></h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li class="tsd-parameter-siganture">
|
||||
<ul class="tsd-signatures tsd-kind-type-literal">
|
||||
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>state<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">S</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">S</span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li>
|
||||
<h5>state: <span class="tsd-signature-type">S</span></h5>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">S</span></h4>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
|
||||
<a name="upreducer" class="tsd-anchor"></a>
|
||||
<h3>upreducer</h3>
|
||||
@ -460,7 +533,7 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:168</li>
|
||||
<li>Defined in updux.ts:170</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<h4 class="tsd-returns-title">Returns <a href="../globals.html#upreducer" class="tsd-signature-type">Upreducer</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">S</span><span class="tsd-signature-symbol">></span></h4>
|
||||
@ -474,13 +547,13 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<a name="addmutation" class="tsd-anchor"></a>
|
||||
<h3>add<wbr>Mutation</h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter">
|
||||
<li class="tsd-signature tsd-kind-icon">add<wbr>Mutation<A><span class="tsd-signature-symbol">(</span>creator<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">A</span>, mutation<span class="tsd-signature-symbol">: </span><a href="../globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">S</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">A extends (...args: any[]) => infer R ? R : never</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
|
||||
<li class="tsd-signature tsd-kind-icon">add<wbr>Mutation<A><span class="tsd-signature-symbol">(</span>creator<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">A</span>, mutation<span class="tsd-signature-symbol">: </span><a href="../globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">S</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">A extends (...args: any[]) => infer R ? R : never</span><span class="tsd-signature-symbol">></span>, isSink<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in updux.ts:253</li>
|
||||
<li>Defined in updux.ts:279</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
@ -508,6 +581,13 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li>
|
||||
<h5>mutation: <a href="../globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">S</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">A extends (...args: any[]) => infer R ? R : never</span><span class="tsd-signature-symbol">></span></h5>
|
||||
</li>
|
||||
<li>
|
||||
<h5><span class="tsd-flag ts-flagOptional">Optional</span> isSink: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span></h5>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<p>If <code>true</code>, disables the subduxes mutations for this action. To
|
||||
conditionally run the subduxes mutations, check out <a href="updux.html#subduxupreducer">subduxUpreducer</a>.</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||
</li>
|
||||
@ -560,6 +640,9 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
|
||||
<a href="updux.html#reducer" class="tsd-kind-icon">reducer</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
|
||||
<a href="updux.html#subduxupreducer" class="tsd-kind-icon">subdux<wbr>Upreducer</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
|
||||
<a href="updux.html#upreducer" class="tsd-kind-icon">upreducer</a>
|
||||
</li>
|
||||
@ -594,9 +677,6 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
|
||||
<a href="../globals.html#mutation" class="tsd-kind-icon">Mutation</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a href="../globals.html#mystate" class="tsd-kind-icon">My<wbr>State</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a href="../globals.html#next" class="tsd-kind-icon">Next</a>
|
||||
</li>
|
||||
@ -645,15 +725,6 @@ store.dispatch<span class="hljs-comment">( actions.addTodo(...)</span> );</code>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="../globals.html#composemutations" class="tsd-kind-icon">compose<wbr>Mutations</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="../globals.html#noopeffect" class="tsd-kind-icon">noop<wbr>Effect</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="../globals.html#timeout" class="tsd-kind-icon">timeout</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="../globals.html#tracer" class="tsd-kind-icon">tracer</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -84,7 +84,6 @@
|
||||
<li class="tsd-kind-type-alias tsd-has-type-parameter"><a href="globals.html#dux" class="tsd-kind-icon">Dux</a></li>
|
||||
<li class="tsd-kind-type-alias tsd-has-type-parameter tsd-is-not-exported"><a href="globals.html#maybepayload" class="tsd-kind-icon">Maybe<wbr>Payload</a></li>
|
||||
<li class="tsd-kind-type-alias tsd-has-type-parameter"><a href="globals.html#mutation" class="tsd-kind-icon">Mutation</a></li>
|
||||
<li class="tsd-kind-type-alias tsd-is-not-exported"><a href="globals.html#mystate" class="tsd-kind-icon">My<wbr>State</a></li>
|
||||
<li class="tsd-kind-type-alias tsd-is-not-exported"><a href="globals.html#next" class="tsd-kind-icon">Next</a></li>
|
||||
<li class="tsd-kind-type-alias tsd-has-type-parameter tsd-is-not-exported"><a href="globals.html#storewithdispatchactions" class="tsd-kind-icon">Store<wbr>With<wbr>Dispatch<wbr>Actions</a></li>
|
||||
<li class="tsd-kind-type-alias tsd-is-not-exported"><a href="globals.html#submutations" class="tsd-kind-icon">Sub<wbr>Mutations</a></li>
|
||||
@ -106,9 +105,6 @@
|
||||
<li class="tsd-kind-function"><a href="globals.html#buildmutations" class="tsd-kind-icon">build<wbr>Mutations</a></li>
|
||||
<li class="tsd-kind-function tsd-has-type-parameter"><a href="globals.html#buildupreducer" class="tsd-kind-icon">build<wbr>Upreducer</a></li>
|
||||
<li class="tsd-kind-function tsd-is-not-exported"><a href="globals.html#composemutations" class="tsd-kind-icon">compose<wbr>Mutations</a></li>
|
||||
<li class="tsd-kind-function tsd-is-not-exported"><a href="globals.html#noopeffect" class="tsd-kind-icon">noop<wbr>Effect</a></li>
|
||||
<li class="tsd-kind-function tsd-is-not-exported"><a href="globals.html#timeout" class="tsd-kind-icon">timeout</a></li>
|
||||
<li class="tsd-kind-function tsd-is-not-exported"><a href="globals.html#tracer" class="tsd-kind-icon">tracer</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
@ -312,24 +308,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a name="mystate" class="tsd-anchor"></a>
|
||||
<h3>My<wbr>State</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">My<wbr>State<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in addMutations.test.ts:3</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-type-declaration">
|
||||
<h4>Type declaration</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li class="tsd-parameter">
|
||||
<h5>sum<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a name="next" class="tsd-anchor"></a>
|
||||
<h3>Next</h3>
|
||||
@ -932,7 +910,7 @@ const rootUpdux = updux({
|
||||
<a name="buildmutations" class="tsd-anchor"></a>
|
||||
<h3>build<wbr>Mutations</h3>
|
||||
<ul class="tsd-signatures tsd-kind-function">
|
||||
<li class="tsd-signature tsd-kind-icon">build<wbr>Mutations<span class="tsd-signature-symbol">(</span>mutations<span class="tsd-signature-symbol">?: </span><a href="globals.html#dictionary" class="tsd-signature-type">Dictionary</a><span class="tsd-signature-symbol"><</span><a href="globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol">></span>, subduxes<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">></span></li>
|
||||
<li class="tsd-signature tsd-kind-icon">build<wbr>Mutations<span class="tsd-signature-symbol">(</span>mutations<span class="tsd-signature-symbol">?: </span><a href="globals.html#dictionary" class="tsd-signature-type">Dictionary</a><span class="tsd-signature-symbol"><</span><a href="globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Object</span><span class="tsd-signature-symbol">></span>, subduxes<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">></span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
@ -944,7 +922,7 @@ const rootUpdux = updux({
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li>
|
||||
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> mutations: <a href="globals.html#dictionary" class="tsd-signature-type">Dictionary</a><span class="tsd-signature-symbol"><</span><a href="globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></h5>
|
||||
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> mutations: <a href="globals.html#dictionary" class="tsd-signature-type">Dictionary</a><span class="tsd-signature-symbol"><</span><a href="globals.html#mutation" class="tsd-signature-type">Mutation</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></h5>
|
||||
</li>
|
||||
<li>
|
||||
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> subduxes: <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol"> = {}</span></h5>
|
||||
@ -1050,69 +1028,6 @@ const rootUpdux = updux({
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-function tsd-is-not-exported">
|
||||
<a name="noopeffect" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagConst">Const</span> noop<wbr>Effect</h3>
|
||||
<ul class="tsd-signatures tsd-kind-function tsd-is-not-exported">
|
||||
<li class="tsd-signature tsd-kind-icon">noop<wbr>Effect<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">(Anonymous function)</span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in actions.test.ts:4</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">(Anonymous function)</span></h4>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-function tsd-is-not-exported">
|
||||
<a name="timeout" class="tsd-anchor"></a>
|
||||
<h3>timeout</h3>
|
||||
<ul class="tsd-signatures tsd-kind-function tsd-is-not-exported">
|
||||
<li class="tsd-signature tsd-kind-icon">timeout<span class="tsd-signature-symbol">(</span>ms<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in test.ts:125</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li>
|
||||
<h5>ms: <span class="tsd-signature-type">number</span></h5>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h4>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-function tsd-is-not-exported">
|
||||
<a name="tracer" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagConst">Const</span> tracer</h3>
|
||||
<ul class="tsd-signatures tsd-kind-function tsd-is-not-exported">
|
||||
<li class="tsd-signature tsd-kind-icon">tracer<span class="tsd-signature-symbol">(</span>chr<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">CurriedUpdate1</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span></li>
|
||||
</ul>
|
||||
<ul class="tsd-descriptions">
|
||||
<li class="tsd-description">
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in splat.test.ts:4</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li>
|
||||
<h5>chr: <span class="tsd-signature-type">string</span></h5>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">CurriedUpdate1</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span></h4>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
||||
@ -1152,9 +1067,6 @@ const rootUpdux = updux({
|
||||
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
|
||||
<a href="globals.html#mutation" class="tsd-kind-icon">Mutation</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a href="globals.html#mystate" class="tsd-kind-icon">My<wbr>State</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a href="globals.html#next" class="tsd-kind-icon">Next</a>
|
||||
</li>
|
||||
@ -1203,15 +1115,6 @@ const rootUpdux = updux({
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#composemutations" class="tsd-kind-icon">compose<wbr>Mutations</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#noopeffect" class="tsd-kind-icon">noop<wbr>Effect</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#timeout" class="tsd-kind-icon">timeout</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#tracer" class="tsd-kind-icon">tracer</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -138,7 +138,7 @@ store.dispatch.inc(<span class="hljs-number">3</span>);</code></pre>
|
||||
<h1>Description</h1>
|
||||
</a>
|
||||
<p>The formal documentation of the class Updux and its associated functions and
|
||||
types can be found over <a href="./docs/classes/updux.html">here</a>.</p>
|
||||
types can be found over <a href="https://yanick.github.io/updux/docs/classes/updux.html">here</a>.</p>
|
||||
<a href="#exporting-upduxes" id="exporting-upduxes" style="color: inherit; text-decoration: none;">
|
||||
<h2>Exporting upduxes</h2>
|
||||
</a>
|
||||
@ -168,6 +168,49 @@ const updux = new Updux({ <span class="hljs-built_in">..</span>. });
|
||||
createStore,
|
||||
middleware,
|
||||
} = updux;</code></pre>
|
||||
<a href="#mapping-a-mutation-to-all-values-of-a-state" id="mapping-a-mutation-to-all-values-of-a-state" style="color: inherit; text-decoration: none;">
|
||||
<h2>Mapping a mutation to all values of a state</h2>
|
||||
</a>
|
||||
<p>Say you have a <code>todos</code> state that is an array of <code>todo</code> sub-states. It's easy
|
||||
enough to have the main reducer maps away all items to the sub-reducer:</p>
|
||||
<pre><code>const todo = <span class="hljs-keyword">new</span> Updux({
|
||||
mutations: {
|
||||
review: <span class="hljs-function"><span class="hljs-params">()</span> =></span> u({ reviewed: <span class="hljs-literal">true</span>}),
|
||||
done: <span class="hljs-function"><span class="hljs-params">()</span> =></span> u({done: <span class="hljs-literal">true</span>}),
|
||||
},
|
||||
});
|
||||
|
||||
const todos = <span class="hljs-keyword">new</span> Updux({ initial: [] });
|
||||
|
||||
todos.addMutation(
|
||||
todo.actions.review,
|
||||
<span class="hljs-function"><span class="hljs-params">(_,action)</span> =></span> state => state.map( todo.upreducer(action) )
|
||||
);
|
||||
todos.addMutation(
|
||||
todo.actions.done,
|
||||
<span class="hljs-function"><span class="hljs-params">(id,action)</span> =></span> u.map(u.<span class="hljs-keyword">if</span>(u.<span class="hljs-keyword">is</span>(<span class="hljs-string">'id'</span>,id), todo.upreducer(action))),
|
||||
);
|
||||
</code></pre><p>But <code>updeep</code> can iterate through all the items of an array (or the values of
|
||||
an object) via the special key <code>*</code>. So the todos updux above could also be
|
||||
written:</p>
|
||||
<pre><code>const todo = <span class="hljs-keyword">new</span> Updux({
|
||||
mutations: {
|
||||
review: <span class="hljs-function"><span class="hljs-params">()</span> =></span> u({ reviewed: <span class="hljs-literal">true</span>}),
|
||||
done: <span class="hljs-function"><span class="hljs-params">()</span> =></span> u({done: <span class="hljs-literal">true</span>}),
|
||||
},
|
||||
});
|
||||
|
||||
const todos = <span class="hljs-keyword">new</span> Updux({
|
||||
subduxes: { <span class="hljs-string">'*'</span>: todo },
|
||||
});
|
||||
|
||||
todos.addMutation(
|
||||
todo.actions.done,
|
||||
<span class="hljs-function"><span class="hljs-params">(id,action)</span> =></span> u.map(u.<span class="hljs-keyword">if</span>(u.<span class="hljs-keyword">is</span>(<span class="hljs-string">'id'</span>,id), todo.upreducer(action))),
|
||||
<span class="hljs-literal">true</span>
|
||||
);</code></pre><p>The advantages being that the actions/mutations/effects of the subdux will be
|
||||
imported by the root updux as usual, and all actions that aren't being
|
||||
overridden by a sink mutation will trickle down automatically.</p>
|
||||
<a href="#usage-with-immer" id="usage-with-immer" style="color: inherit; text-decoration: none;">
|
||||
<h2>Usage with Immer</h2>
|
||||
</a>
|
||||
@ -244,9 +287,6 @@ const updux = new Updux({ <span class="hljs-built_in">..</span>. });
|
||||
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
|
||||
<a href="globals.html#mutation" class="tsd-kind-icon">Mutation</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a href="globals.html#mystate" class="tsd-kind-icon">My<wbr>State</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias tsd-is-not-exported">
|
||||
<a href="globals.html#next" class="tsd-kind-icon">Next</a>
|
||||
</li>
|
||||
@ -295,15 +335,6 @@ const updux = new Updux({ <span class="hljs-built_in">..</span>. });
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#composemutations" class="tsd-kind-icon">compose<wbr>Mutations</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#noopeffect" class="tsd-kind-icon">noop<wbr>Effect</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#timeout" class="tsd-kind-icon">timeout</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-function tsd-is-not-exported">
|
||||
<a href="globals.html#tracer" class="tsd-kind-icon">tracer</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user