neo icon indicating copy to clipboard operation
neo copied to clipboard

Formulas in ViewModel and ViewController

Open Dinkh opened this issue 3 years ago • 0 comments

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) {}

Dinkh avatar Jun 20 '22 09:06 Dinkh