wip
This commit is contained in:
parent
fd064f5996
commit
0870767994
@ -37,6 +37,10 @@ export class Updux {
|
||||
return this.#memoActions(this.#actions, this.#subduxes);
|
||||
}
|
||||
|
||||
get selectors() {
|
||||
return {};
|
||||
}
|
||||
|
||||
addAction(type, payloadFunc) {
|
||||
const theAction = action(type,payloadFunc);
|
||||
|
||||
@ -44,4 +48,8 @@ export class Updux {
|
||||
|
||||
return theAction;
|
||||
}
|
||||
|
||||
addSelector(name, func) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,10 @@ test('addAction', async(t) => {
|
||||
test('basic selectors', async(t) => {
|
||||
const alpha = new Updux({
|
||||
initial: { quux: 3 },
|
||||
}).addSelector('getQuux', ({ quux }) => quux);
|
||||
selectors: {
|
||||
getQuux: ({quux}) => quux
|
||||
}
|
||||
});
|
||||
|
||||
const dux = new Updux({
|
||||
initial: {
|
||||
@ -70,10 +73,10 @@ test('basic selectors', async(t) => {
|
||||
selectors: {
|
||||
getBar: ({ bar }) => bar,
|
||||
},
|
||||
})
|
||||
.addSelector('getFoo', (state) => state.foo)
|
||||
.addSelector('getAdd', ({ foo }) => (add) => add + foo)
|
||||
.addAction('stuff');
|
||||
});
|
||||
dux.addSelector('getFoo', (state) => state.foo)
|
||||
dux.addSelector('getAdd', ({ foo }) => (add) => add + foo)
|
||||
dux.addAction('stuff');
|
||||
|
||||
t.equal(dux.selectors.getBar({ bar: 3 }), 3);
|
||||
t.equal(dux.selectors.getFoo({ foo: 3 }) , 3);
|
||||
|
Loading…
Reference in New Issue
Block a user