You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to accept multiple params as AND: take(filter1, andFilter2)(reaction)
to write OR we will use as many take as OR or use filter parameter as a fonction
Add a new function takeWith wich flips the parameters of take : takeWhile(reaction)(filter)
// todos.jsimport{takeWith}from'k-simple-state'exportconstcompleteWhen=takeWith(action,store)=>{const{ todos }=store.dataconsttodo=todos.get(action.payload)todos.set({ ...todos,completed: true})}
// listeners.jsimport{take}from'k-simple-state'import{completeWhen}from'./todos'exportdefault[completeWhen('/action/full/path'),completeWhen('/action2/full/path'),take('/action3/full/path/')((action,tree)=>/* do something */),take('/action4/full/path/',({args : [x,y]})=>x>y)((action,tree)=>/* do something */)]
The text was updated successfully, but these errors were encountered:
Refactor take :
take(filter)(reaction)
take(filter1, andFilter2)(reaction)
Add a new function
takeWith
wich flips the parameters oftake
:takeWhile(reaction)(filter)
The text was updated successfully, but these errors were encountered: