Skip to content

Commit e88268d

Browse files
author
Erwan Carriou
committed
work in progress for the 0.6.0:
- a 'on' method call aplly on the current state and not on a changed of state only. example: you can use "monoco.on('ready', ... " wherever you want, it will launch the action: - when the state of monoco changed for "ready" status or - if the current state of monoco is "ready".
1 parent 090d420 commit e88268d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+446
-309
lines changed

Gruntfile.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports = function (grunt) {
102102
options: {
103103
process: function (src, filepath) {
104104
var uid = generateId(),
105-
result = '';
105+
result = '';
106106

107107
function generateId() {
108108
function gen() {
@@ -139,7 +139,7 @@ module.exports = function (grunt) {
139139
options: {
140140
process: function (src, filepath) {
141141
var result = '',
142-
uid = '';
142+
uid = '';
143143

144144
if (filepath.indexOf('build') !== -1) {
145145
result = src + '},\n"schemas" : {';
@@ -158,7 +158,7 @@ module.exports = function (grunt) {
158158
options: {
159159
process: function (src, filepath) {
160160
var result = '',
161-
uid = '';
161+
uid = '';
162162

163163
if (filepath.indexOf('build') !== -1) {
164164
result = src + '},\n"types" : {';
@@ -177,8 +177,8 @@ module.exports = function (grunt) {
177177
options: {
178178
process: function (src, filepath) {
179179
var result = '',
180-
uid = '',
181-
collectionName = '';
180+
uid = '',
181+
collectionName = '';
182182

183183
if (filepath.indexOf('build') !== -1) {
184184
result = src + '},\n"components" : {';
@@ -298,4 +298,4 @@ module.exports = function (grunt) {
298298
'concat:licence',
299299
'karma:monoco'
300300
]);
301-
};
301+
};

addons/web.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"_id": "1f6001773a18791",
1818
"component": "e89c617b6b15d24",
1919
"state": "main",
20-
"action": "function main() { var systems = [], system = null, i = 0, length = 0; if (typeof document !== 'undefined') { systems = document.querySelectorAll('link[rel=system]'); length = systems.length; for (i = 0; i < length; i++) { system = systems[i]; if (system.getAttribute('async') === 'true') { this.require('monoco').load(system.href, true); } else { this.require('monoco').load(system.href, false); } } }}",
20+
"action": "function main() { var systems = [], system = null, i = 0, length = 0; if (typeof document !== 'undefined') { systems = document.querySelectorAll('link[rel=system]'); length = systems.length; for (i = 0; i < length; i++) { system = systems[i]; if (system.getAttribute('async') === 'true') { this.require('monoco').load(system.href, true); } else { this.require('monoco').load(system.href, false); } } if (length === 0) { this.require('monoco').ready(); } }}",
2121
"core": true
2222
}
2323
},

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monoco",
3-
"version": "0.5.6",
3+
"version": "0.6.0",
44
"description": "A Model and a NoSQL Database for Component",
55
"license": "GPL-3.0",
66
"homepage": "https://github.com/monocojs/monoco.git",

build/monoco-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/monoco.js

Lines changed: 101 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/monoco.json

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monoco",
3-
"version": "0.5.6",
3+
"version": "0.6.0",
44
"description": "A Model and a NoSQL Database for Components",
55
"_id": "e89c617b6b15d24",
66
"types": {
@@ -160,184 +160,184 @@
160160
"_id": "1aaee1e6311ff39",
161161
"component": "monoco",
162162
"state": "load",
163-
"action": "function load(url, async) { var xhr = null, callbackLoad = null; xhr = new XMLHttpRequest(); callbackLoad = function callbackLoad(system) { var sysId = $db.system(system); var sys = $component.get(sysId); var systems = document.querySelectorAll('link[rel=system]'); if (sys) { sys.main(); } if (systems.length + 1 === $db.MonocoSystem.count() ) { $component.get('monoco').ready(); } }; if (async) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } } }; xhr.send(null); } else { xhr.open('GET', url, false); xhr.send(null); if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } }}",
163+
"action": "function load(url, async) { var xhr = null, callbackLoad = null; xhr = new XMLHttpRequest(); callbackLoad = function callbackLoad(system) { var sysId = $db.system(system); var sys = $component.get(sysId); var systems = document.querySelectorAll('link[rel=system]'); if (sys) { sys.main(); } if (systems.length + 1 === $db.MonocoSystem.count() ) { $component.get('monoco').ready(); } }; if (async) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } } }; xhr.send(null); } else { xhr.open('GET', url, false); xhr.send(null); if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } }}",
164164
"core": true,
165165
"useCoreAPI": true
166166
},
167167
"1f6001773a18791": {
168168
"_id": "1f6001773a18791",
169169
"component": "e89c617b6b15d24",
170170
"state": "main",
171-
"action": "function main() { var systems = [], system = null, i = 0, length = 0; if (typeof document !== 'undefined') { systems = document.querySelectorAll('link[rel=system]'); length = systems.length; for (i = 0; i < length; i++) { system = systems[i]; if (system.getAttribute('async') === 'true') { this.require('monoco').load(system.href, true); } else { this.require('monoco').load(system.href, false); } } }}",
171+
"action": "function main() { var systems = [], system = null, i = 0, length = 0; if (typeof document !== 'undefined') { systems = document.querySelectorAll('link[rel=system]'); length = systems.length; for (i = 0; i < length; i++) { system = systems[i]; if (system.getAttribute('async') === 'true') { this.require('monoco').load(system.href, true); } else { this.require('monoco').load(system.href, false); } } if (length === 0) { this.require('monoco').ready(); } }}",
172172
"core": true
173173
},
174-
"1844f1170f10a93": {
175-
"_id": "1844f1170f10a93",
174+
"15e971f11b1f29a": {
175+
"_id": "15e971f11b1f29a",
176176
"component": "Monoco",
177177
"state": "error",
178178
"action": "function error(data) { console.error('monoco: ' + data.message, data.error); }",
179179
"core": true
180180
},
181-
"1cd211e37314cc4": {
182-
"_id": "1cd211e37314cc4",
181+
"1e59310557166fa": {
182+
"_id": "1e59310557166fa",
183183
"component": "Monoco",
184184
"state": "find",
185185
"action": "function find(Class, query) { return $component.find(Class, query);}",
186186
"core": true,
187187
"useCoreAPI": true
188188
},
189-
"1b1af1f1b614180": {
190-
"_id": "1b1af1f1b614180",
189+
"15c3714e8d1f823": {
190+
"_id": "15c3714e8d1f823",
191191
"component": "Monoco",
192192
"state": "system",
193193
"action": "function system(name) { var System = null, system = {}, result = [], conf = {}; if (name) { conf.master = true; conf.name = name; System = this.require('MonocoSystem'); system = new System(conf); } else { result = this.find('MonocoSystem', {'master': true}); if (result.length) { system = result[0]; } } return system; }",
194194
"core": true
195195
},
196-
"194e5100081648c": {
197-
"_id": "194e5100081648c",
196+
"1d029183b812ac2": {
197+
"_id": "1d029183b812ac2",
198198
"component": "Monoco",
199199
"state": "warning",
200200
"action": "function warning(message) { console.warn('monoco: ' + message); }",
201201
"core": true
202202
},
203-
"1ed0e1d05610cae": {
204-
"_id": "1ed0e1d05610cae",
203+
"1263c12ca818e51": {
204+
"_id": "1263c12ca818e51",
205205
"component": "MonocoChannel",
206206
"state": "listen",
207207
"action": "function listen(event, action) { $channel.listen(event, action); }",
208208
"core": true,
209209
"useCoreAPI": true
210210
},
211-
"14a051726e1f251": {
212-
"_id": "14a051726e1f251",
211+
"170241a1521fd56": {
212+
"_id": "170241a1521fd56",
213213
"component": "MonocoChannel",
214214
"state": "send",
215215
"action": "function send(message) { return $channel.send(message); }",
216216
"core": true,
217217
"useCoreAPI": true
218218
},
219-
"167981ac281700a": {
220-
"_id": "167981ac281700a",
219+
"104901f13318a98": {
220+
"_id": "104901f13318a98",
221221
"component": "MonocoClassInfo",
222222
"state": "collection",
223223
"action": "function collection(name) { var result = {}; if (this.metamodel()[name] === 'collection') { result = this.model()[name]; } return result; }",
224224
"core": true
225225
},
226-
"169ca13ac7193e6": {
227-
"_id": "169ca13ac7193e6",
226+
"1eed818e7c1a394": {
227+
"_id": "1eed818e7c1a394",
228228
"component": "MonocoClassInfo",
229229
"state": "collections",
230230
"action": "function collections() { var keys = Object.keys(this.metamodel()), item = '', result = [], i = 0, length = 0; length = keys.length; for (i = 0; i < length; i++) { item = keys[i]; if (this.metamodel()[item] === 'collection') { result.push(item); } } return result; }",
231231
"core": true
232232
},
233-
"1e4891c025150bd": {
234-
"_id": "1e4891c025150bd",
233+
"12ece10baa19e77": {
234+
"_id": "12ece10baa19e77",
235235
"component": "MonocoClassInfo",
236236
"state": "event",
237237
"action": "function event(name) { var result = {}; if (this.metamodel()[name] === 'event') { result = this.model()[name]; } return result; }",
238238
"core": true
239239
},
240-
"138301b0b31a87d": {
241-
"_id": "138301b0b31a87d",
240+
"10f5711d26199ad": {
241+
"_id": "10f5711d26199ad",
242242
"component": "MonocoClassInfo",
243243
"state": "events",
244244
"action": "function events() { var keys = Object.keys(this.metamodel()), item = '', result = [], i = 0, length = 0; length = keys.length; for (i = 0; i < length; i++) { item = keys[i]; if (this.metamodel()[item] === 'event') { result.push(item); } } return result; }",
245245
"core": true
246246
},
247-
"1b3a11e5fb1f330": {
248-
"_id": "1b3a11e5fb1f330",
247+
"13dad18466185d8": {
248+
"_id": "13dad18466185d8",
249249
"component": "MonocoClassInfo",
250250
"state": "method",
251251
"action": "function method(name) { var result = {}; if (this.metamodel()[name] === 'method') { result = this.model()[name]; } return result; }",
252252
"core": true
253253
},
254-
"1b54f1dfbd1642a": {
255-
"_id": "1b54f1dfbd1642a",
254+
"1c3c211fd31ca88": {
255+
"_id": "1c3c211fd31ca88",
256256
"component": "MonocoClassInfo",
257257
"state": "methods",
258258
"action": "function methods() { var keys = Object.keys(this.metamodel()), item = '', result = [], i = 0, length = 0; length = keys.length; for (i = 0; i < length; i++) { item = keys[i]; if (this.metamodel()[item] === 'method') { result.push(item); } } return result; }",
259259
"core": true
260260
},
261-
"1d84c124b917568": {
262-
"_id": "1d84c124b917568",
261+
"17e671ae7f17a5d": {
262+
"_id": "17e671ae7f17a5d",
263263
"component": "MonocoClassInfo",
264264
"state": "properties",
265265
"action": "function properties() { var keys = Object.keys(this.metamodel()), item = '', result = [], i = 0, length = 0; length = keys.length; for (i = 0; i < length; i++) { item = keys[i]; if (this.metamodel()[item] === 'property') { result.push(item); } } return result; }",
266266
"core": true
267267
},
268-
"15ea51c0411fa04": {
269-
"_id": "15ea51c0411fa04",
268+
"158e410c821e40b": {
269+
"_id": "158e410c821e40b",
270270
"component": "MonocoClassInfo",
271271
"state": "property",
272272
"action": "function property(name) { var result = {}; if (this.metamodel()[name] === 'property') { result = this.model()[name]; } return result; }",
273273
"core": true
274274
},
275-
"10d1e190141273c": {
276-
"_id": "10d1e190141273c",
275+
"178a7147dc16000": {
276+
"_id": "178a7147dc16000",
277277
"component": "MonocoComponent",
278278
"state": "destroy",
279279
"action": "function destroy() { $component.destroy(this.id()); }",
280280
"core": true,
281281
"useCoreAPI": true
282282
},
283-
"1a9e81c3d814c37": {
284-
"_id": "1a9e81c3d814c37",
283+
"174091912d19d67": {
284+
"_id": "174091912d19d67",
285285
"component": "MonocoComponent",
286286
"state": "off",
287287
"action": "function off(state, behaviorId) { var args = [], i = 0, length = 0; length = arguments.length; for (i = 0; i < length - 7; i++) { args.push(arguments[i]); } if ($workflow.checkParams({\"component\": this, \"methodName\": \"off\", \"args\": args})) { if ($metamodel.isValidState(state, this.constructor.name)) {$behavior.remove({\"behaviorId\": behaviorId, \"componentId\": this.id(), \"state\": state}); } else { $helper.getMonoco().warning({ \"message\":\"invoke 'off' method of component '\" + this.id() + \"' with an invalid state '\" + state + \"'\"}); } } }",
288288
"core": true,
289289
"useCoreAPI": true
290290
},
291-
"1587213672157db": {
292-
"_id": "1587213672157db",
291+
"15d81160c412056": {
292+
"_id": "15d81160c412056",
293293
"component": "MonocoComponent",
294294
"state": "require",
295295
"action": "function require(id) { return $component.get(id); }",
296296
"core": true,
297297
"useCoreAPI": true
298298
},
299-
"116291dd081fe35": {
300-
"_id": "116291dd081fe35",
299+
"1359118bf5109c4": {
300+
"_id": "1359118bf5109c4",
301301
"component": "MonocoDatabase",
302302
"state": "subsystem",
303303
"action": "function subsystem(params) { return $db.subsystem(params); }",
304304
"core": true,
305305
"useCoreAPI": true
306306
},
307-
"142b51c0761b94f": {
308-
"_id": "142b51c0761b94f",
307+
"1364a11ac314806": {
308+
"_id": "1364a11ac314806",
309309
"component": "MonocoDatabase",
310310
"state": "system",
311311
"action": "function system(system) { return $db.system(system); }",
312312
"core": true,
313313
"useCoreAPI": true
314314
},
315-
"155981ca4315040": {
316-
"_id": "155981ca4315040",
315+
"1fbbc19a501ee80": {
316+
"_id": "1fbbc19a501ee80",
317317
"component": "MonocoMetamodel",
318318
"state": "create",
319319
"action": "function create() { $metamodel.create(); }",
320320
"core": true,
321321
"useCoreAPI": true
322322
},
323-
"160a5177e510bb7": {
324-
"_id": "160a5177e510bb7",
323+
"109861084618f2e": {
324+
"_id": "109861084618f2e",
325325
"component": "MonocoMetamodel",
326326
"state": "schema",
327327
"action": "function schema(schema) { $metamodel.schema(schema); }",
328328
"core": true,
329329
"useCoreAPI": true
330330
},
331-
"152c5102e91d05d": {
332-
"_id": "152c5102e91d05d",
331+
"104bc117281df7a": {
332+
"_id": "104bc117281df7a",
333333
"component": "MonocoMetamodel",
334334
"state": "type",
335335
"action": "function type(type) { $metamodel.type(type); }",
336336
"core": true,
337337
"useCoreAPI": true
338338
},
339-
"1bf0c1f1a414068": {
340-
"_id": "1bf0c1f1a414068",
339+
"189ae1ab3d1f380": {
340+
"_id": "189ae1ab3d1f380",
341341
"component": "MonocoSystem",
342342
"state": "sync",
343343
"action": "function sync() { var dump = $db.dump(); this.schemas(dump.schemas); this.types(dump.types); this.behaviors(dump.behaviors); this.components(dump.components); }",
@@ -349,7 +349,7 @@
349349
"Monoco": {
350350
"monoco": {
351351
"_id": "monoco",
352-
"version": "0.5.6"
352+
"version": "0.6.0"
353353
}
354354
},
355355
"MonocoChannel": {
@@ -873,13 +873,20 @@
873873
"readOnly": false,
874874
"mandatory": true,
875875
"default": ""
876+
},
877+
"parameters": {
878+
"type": "object",
879+
"readOnly": false,
880+
"mandatory": false,
881+
"default": {}
876882
}
877883
},
878884
"MonocoStateSchema": {
879885
"_id": "MonocoStateSchema",
880886
"_name": "MonocoStateSchema",
881887
"_core": true,
882-
"name": "property"
888+
"name": "property",
889+
"parameters": "property"
883890
},
884891
"MonocoSystem": {
885892
"_id": "MonocoSystem",

0 commit comments

Comments
 (0)