neo
neo copied to clipboard
Formulas in ViewModel and ViewController
I would like to get an easy way of listening to changes in viewModel Data and Store-configs These should be listened to in formulas in the viewModel and viewController
@example ##viewModel
data: {
a: 1
},
stores: {
mystore: {
isLoading: false // config of the current state of the store
}
}
formulas: {
b: {
bind: {a: 'a'},
get(data => toUppercase(data.a);)
},
storeIsLoading: {
bind: {isLoading: 'mystore.isLoading',
get(data) {return isLoading}
}
}
##viewController
formulas: {
b: {
bind: {a: 'a'},
fn: 'onAChange'
},
storeIsLoading: {
bind: {isLoading: 'mystore.isLoading',
fn: 'onStoreLoadingChange'
}
},
onAChange(value, oldValue) {},
onStoreLoadingChange(value, oldValue) {}