react 0.2.6 → 0.3.0

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 (61) hide show
  1. package/README.md +8 -7
  2. package/{lib → dsl}/chain.js +5 -3
  3. package/{lib → dsl}/fstr.js +7 -5
  4. package/{lib → dsl}/pcode.js +8 -6
  5. package/examples/chain-events1.js +3 -3
  6. package/examples/chain1.js +2 -2
  7. package/examples/default-events1.js +2 -2
  8. package/examples/fstr-events1.js +4 -3
  9. package/examples/fstr1.js +3 -2
  10. package/examples/pcode1.js +2 -2
  11. package/lib/base-task.js +1 -0
  12. package/lib/cb-task.js +14 -1
  13. package/lib/core.js +33 -9
  14. package/lib/dsl.js +14 -6
  15. package/lib/event-manager.js +16 -5
  16. package/lib/finalcb-first-task.js +9 -6
  17. package/lib/finalcb-task.js +9 -6
  18. package/lib/input-parser.js +7 -3
  19. package/lib/parse.js +6 -3
  20. package/lib/promise-task.js +89 -0
  21. package/lib/ret-task.js +1 -1
  22. package/lib/task.js +23 -19
  23. package/lib/validate.js +3 -3
  24. package/lib/vcon.js +6 -3
  25. package/lib/when-task.js +81 -0
  26. package/package.json +4 -2
  27. package/promise-resolve.js +35 -0
  28. package/react.js +0 -4
  29. package/test/core-deferred.test.js +134 -0
  30. package/test/core-promised.test.js +132 -0
  31. package/test/core-when.test.js +84 -0
  32. package/test/core.test.js +63 -4
  33. package/test/dsl.test.js +58 -6
  34. package/test/{chain.test.js → dsl/chain.test.js} +71 -1
  35. package/test/{fstr.test.js → dsl/fstr.test.js} +1 -1
  36. package/test/{pcode.test.js → dsl/pcode.test.js} +122 -1
  37. package/test/exec-options.test.js +2 -1
  38. package/test/finalcb-task.test.js +6 -5
  39. package/test/input-parser.test.js +10 -6
  40. package/test/module-use.test.js +2 -190
  41. package/test/promise-auto-resolve.test.js +51 -0
  42. package/test/validate.test.js +4 -2
  43. package/test/vcon.test.js +13 -0
  44. package/oldExamples/analyze.js +0 -29
  45. package/oldExamples/analyze2.js +0 -29
  46. package/oldExamples/example10-dsl.js +0 -63
  47. package/oldExamples/example11.js +0 -62
  48. package/oldExamples/example12.js +0 -63
  49. package/oldExamples/example13.js +0 -63
  50. package/oldExamples/example14.js +0 -63
  51. package/oldExamples/example15.js +0 -75
  52. package/oldExamples/example6-ast.js +0 -47
  53. package/oldExamples/example6-dsl.js +0 -49
  54. package/oldExamples/example8-ast.js +0 -55
  55. package/oldExamples/example8-dsl.js +0 -53
  56. package/oldExamples/example9-ast.js +0 -58
  57. package/oldExamples/example9-dsl.js +0 -57
  58. package/oldExamples/function-str-ex1.js +0 -33
  59. package/oldExamples/function-str-ex2.js +0 -67
  60. package/oldExamples/trait1.js +0 -41
  61. package/oldExamples/trait2.js +0 -44
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- var trait = require('light-traits').Trait;
4
-
5
- var tTaskMethods = trait({
6
- ready: trait.required,
7
- isReady: function(){ return this.ready; },
8
- exec: function(){ console.log('exec'); },
9
- toString: function(){ return 'taskMethods'; },
10
- matches: function (taskDef) { return (/foo/.test(taskDef.name)) }
11
- });
12
-
13
- var tDebugOutput = trait({
14
- isReady: trait.required,
15
- //toStringTaskMethods: trait.required,
16
- toString: function(){ return "trait: ready: "+this.isReady() /* +
17
- ' taskMethods: '+this.toStringTaskMethods();*/
18
- }
19
- });
20
-
21
- var tTask = trait.compose(
22
- // tTaskMethods.resolve({ toString: 'toStringTaskMethods' }),
23
- tTaskMethods.resolve({ toString: null }),
24
- tDebugOutput
25
- );
26
-
27
- function taskFactory(ready){
28
- return tTask.create({ ready: ready });
29
- }
30
-
31
- var t = taskFactory(true);
32
- console.log(t.toString());
33
-
34
- if (t.isReady()) {
35
- t.exec();
36
- }
37
-
38
- console.log('foo', tTaskMethods.matches.value({ name: 'foo'}));
39
- console.log('bar', tTaskMethods.matches.value({ name: 'bar'}));
40
-
41
- console.log(tTask);
@@ -1,44 +0,0 @@
1
- 'use strict';
2
-
3
- var trait = require('traits').Trait;
4
-
5
-
6
-
7
-
8
- var tTaskMethods = trait({
9
- ready: trait.required,
10
- isReady: function(){ return this.ready; },
11
- exec: function(){ console.log('exec'); },
12
- toString: function(){ return 'taskMethods'; }
13
- });
14
-
15
- var tDebugOutput = trait({
16
- isReady: trait.required,
17
- toString: function(){ return "trait: ready: "+this.isReady(); }
18
- });
19
-
20
- function Foo() {
21
- }
22
-
23
- Foo.prototype = { };
24
- Foo.prototype.constructor = Foo;
25
- Foo.prototype.greet = function(){ console.log('hello'); };
26
-
27
- function taskFactory(ready){
28
- return Object.create(Foo.prototype, trait.compose(
29
- tTaskMethods,
30
- tDebugOutput,
31
- trait({ ready: ready })
32
- ));
33
- }
34
-
35
-
36
-
37
- var t = taskFactory(true);
38
- console.log(t.toString());
39
-
40
- if (t.isReady()) {
41
- t.exec();
42
- }
43
-
44
- t.greet();