LearnNewsExamplesServices
Frontmatter
id3158
titleViewModel Store listener points to Controller method
stateClosed
labels
enhancement
assignees[]
createdAtJun 15, 2022, 5:53 PM
updatedAtJun 16, 2022, 8:54 PM
githubUrlhttps://github.com/neomjs/neo/issues/3158
authorDinkh
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 16, 2022, 8:54 PM

ViewModel Store listener points to Controller method

Closed v8.1.0 enhancement
Dinkh
Dinkh commented on Jun 15, 2022, 5:53 PM

I would like to add a listener to the ViewModel as a string. The string represents the method inside the ViewController / parent ViewController.

@example

ViewModel

data: {
    userData_: {id: 4}              // _ (Underscore) at end ==>  onUserDataChange method in controller
},
stores: {
    main: {
        module: MainStore,
        listeners: {
            load: 'onMainStoreLoad' // string => method in ViewController
        }
    }
}

ViewController

onUserDataChange(oldData, newData) {doYourStuff}

onMainStoreLoad(store, ...originalEvent) {doYourStuff}
Dinkh added the enhancement label on Jun 15, 2022, 5:53 PM
tobiu referenced in commit aa9a4dc - "ViewModel Store listener points to Controller method #3158" on Jun 16, 2022, 8:53 PM
tobiu
tobiu Jun 16, 2022, 8:53 PM

did some testing:

Screenshot 2022-06-16 at 20 50 37
Screenshot 2022-06-16 at 20 50 47
Screenshot 2022-06-16 at 20 50 57
tobiu closed this issue on Jun 16, 2022, 8:54 PM