neo.mjs 4.0.11 → 4.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/data/Store.mjs +32 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.0.11",
3
+ "version": "4.0.12",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -30,6 +30,19 @@ class Store extends Base {
30
30
  */
31
31
  ntype: 'store',
32
32
  /**
33
+ * Instead of setting an url, you can define the RPC BE API methods.
34
+ * In case the 4 methods are using the same service and this service is using the CRUD based fn-names,
35
+ * you can switch to a string based shortcut.
36
+ * The following 2 examples are equivalent.
37
+ * @example
38
+ * api: {
39
+ * create : 'MyApp.backend.UserService.create',
40
+ * destroy: 'MyApp.backend.UserService.destroy',
41
+ * read : 'MyApp.backend.UserService.read',
42
+ * update : 'MyApp.backend.UserService.update'
43
+ * }
44
+ * @example
45
+ * api: 'MyApp.backend.UserService'
33
46
  * @member {Object|String|null} api_=null
34
47
  */
35
48
  api_: null,
@@ -147,6 +160,25 @@ class Store extends Base {
147
160
  }
148
161
  }
149
162
 
163
+ /**
164
+ * @param {Object|String|null} value
165
+ * @param {Object|String|null} oldValue
166
+ * @protected
167
+ * @returns {Object|null}
168
+ */
169
+ beforeSetApi(value, oldValue) {
170
+ if (Neo.typeOf(value) === 'String') {
171
+ value = {
172
+ create : value + '.create',
173
+ destroy: value + '.destroy',
174
+ read : value + '.read',
175
+ update : value + '.update'
176
+ };
177
+ }
178
+
179
+ return value;
180
+ }
181
+
150
182
  /**
151
183
  * @param value
152
184
  * @param oldValue