var actions = {} ;
actions.edit = function(data) {
data.lastEdited = {title: data.title, description: data.description, id: data.id } ;
present(data) ;
return false ;
} ;
actions.save = function(data) {
data.item = {title: data.title, description: data.description, id: data.id || null} ;
present(data) ;
return false ;
} ;
actions.delete = function(data) {
data = {deletedItemId: data.id} ;
present(data) ;
return false ;
} ;
actions.cancel = function(data) {
present(data) ;
return false ;
} ;
I want to change color (for example) of my view-component and I would like to select this component from DOM
You should not do that, the whole point of V = f(M) is that you (almost) never manipulate the DOM, the color should be part of the model and when you generate the stateRepresentation based on the new application state.
Hi. In the rocket launcher example, ¿What is the purpose of this line?
present = present || model.present ;
When i would want to pass a custom present function? in which cases?
Another question: It's a bad idea to deal with a model directly from an action instead of passing a associative-array like data to model.present() ?
For example:
function actionsLaunch()
{
model.start() //Set model->started member to true
model.present()
}
Instead of:
actions.launch = function(data, present) {
present = present || model.present ;
data.launched = true ;
present(data) ;
}
I'm trying to port it to PHP, and see how it look in an Object-Oriented like style.
Thanks you
Hi I've just started reading on SAM architecture. I like what React has been doing, but everything is actually based on a hunch to be honest, so I'll follow Kyle Simpsons advice and diversify my sources :). It's a long road, but everything begins with a first step.
I have a question;
what are your thinkings on redux-logic?
https://github.com/jeffbski/redux-logic
Best regards.
{
signal: [
...ensureSamState,
guardSamStep,
{
true: [warnBlockedAction],
false: [
set(state`sam.stepInProgress`, true),
getProposal(action),
propose,
getControlState,
ensureControlState,
{
false: [throwError("Invalid control state.")],
true: [
set(state`sam.controlState`, props`controlState`),
getNextAction,
when(props`nextAction`),
{
true: [set(state`sam.napInProgress`, true), runNextAction],
false: [
set(state`sam.napInProgress`, false),
set(state`sam.stepInProgress`, false),
],
},
],
},
],
},
],
catch: new Map([[Error, [logError]]]),
}