11Neo has a feature that allows shared, bindable, data.
22
3- A _ view model _ &mdash ; ` Neo.model.Component ` &mdash ; instance holds properties that
3+ A _ state provider _ &mdash ; ` Neo.state.Provider ` &mdash ; instance holds properties that
44can be bound to component properties.
55
66<pre data-neo >
@@ -12,7 +12,7 @@ class MainView extends Container {
1212 static config = {
1313 className: 'GS.data1.MainView',
1414
15- model : {
15+ stateProvider : {
1616 data: {
1717 foo: 'Hi there!'
1818 }
@@ -83,7 +83,7 @@ class MainView extends Container {
8383 static config = {
8484 className: 'GS.data2.MainView',
8585
86- model : {
86+ stateProvider : {
8787 data: {
8888 foo: 'parent'
8989 }
@@ -95,8 +95,9 @@ class MainView extends Container {
9595 module: MyPanel
9696 }, {
9797 module: MyPanel,
98- // You wouldn't normally configure a view model. We're doing it here to illustrate view model scope.
99- model: {
98+ // You wouldn't normally configure a state provider.
99+ // We're doing it here to illustrate state provider scope.
100+ stateProvider: {
100101 data: {
101102 foo: 'child'
102103 }
@@ -109,7 +110,7 @@ MainView = Neo.setupClass(MainView);
109110</pre >
110111
111112In this case, the main view has three child items of type ` MyPanel ` , each containing a label.
112- The main view has a view model with a ` foo ` property, and the third child has its own view model with a ` foo ` property.
113+ The main view has a state provider with a ` foo ` property, and the third child has its own state provider with a ` foo ` property.
113114
114115<img width =" 75% " src =" https://s3.amazonaws.com/mjs.neo.learning.images/gettingStarted/vm/VisualHierarchyFooShadowed.png " ></img >
115116
@@ -124,5 +125,5 @@ because the third copy of `MyPanel` has its own view model with the `foo` proper
124125
125126## Conclusion
126127
127- The Neo.mjs view model and binding approach is simple and powerful. It gives you easy control
128+ The Neo.mjs state provider and binding approach is simple and powerful. It gives you easy control
128129over the scope of a value, which means you can share properties as globally or narrowly as needed.
0 commit comments