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.
- package/README.md +8 -7
- package/{lib → dsl}/chain.js +5 -3
- package/{lib → dsl}/fstr.js +7 -5
- package/{lib → dsl}/pcode.js +8 -6
- package/examples/chain-events1.js +3 -3
- package/examples/chain1.js +2 -2
- package/examples/default-events1.js +2 -2
- package/examples/fstr-events1.js +4 -3
- package/examples/fstr1.js +3 -2
- package/examples/pcode1.js +2 -2
- package/lib/base-task.js +1 -0
- package/lib/cb-task.js +14 -1
- package/lib/core.js +33 -9
- package/lib/dsl.js +14 -6
- package/lib/event-manager.js +16 -5
- package/lib/finalcb-first-task.js +9 -6
- package/lib/finalcb-task.js +9 -6
- package/lib/input-parser.js +7 -3
- package/lib/parse.js +6 -3
- package/lib/promise-task.js +89 -0
- package/lib/ret-task.js +1 -1
- package/lib/task.js +23 -19
- package/lib/validate.js +3 -3
- package/lib/vcon.js +6 -3
- package/lib/when-task.js +81 -0
- package/package.json +4 -2
- package/promise-resolve.js +35 -0
- package/react.js +0 -4
- package/test/core-deferred.test.js +134 -0
- package/test/core-promised.test.js +132 -0
- package/test/core-when.test.js +84 -0
- package/test/core.test.js +63 -4
- package/test/dsl.test.js +58 -6
- package/test/{chain.test.js → dsl/chain.test.js} +71 -1
- package/test/{fstr.test.js → dsl/fstr.test.js} +1 -1
- package/test/{pcode.test.js → dsl/pcode.test.js} +122 -1
- package/test/exec-options.test.js +2 -1
- package/test/finalcb-task.test.js +6 -5
- package/test/input-parser.test.js +10 -6
- package/test/module-use.test.js +2 -190
- package/test/promise-auto-resolve.test.js +51 -0
- package/test/validate.test.js +4 -2
- package/test/vcon.test.js +13 -0
- package/oldExamples/analyze.js +0 -29
- package/oldExamples/analyze2.js +0 -29
- package/oldExamples/example10-dsl.js +0 -63
- package/oldExamples/example11.js +0 -62
- package/oldExamples/example12.js +0 -63
- package/oldExamples/example13.js +0 -63
- package/oldExamples/example14.js +0 -63
- package/oldExamples/example15.js +0 -75
- package/oldExamples/example6-ast.js +0 -47
- package/oldExamples/example6-dsl.js +0 -49
- package/oldExamples/example8-ast.js +0 -55
- package/oldExamples/example8-dsl.js +0 -53
- package/oldExamples/example9-ast.js +0 -58
- package/oldExamples/example9-dsl.js +0 -57
- package/oldExamples/function-str-ex1.js +0 -33
- package/oldExamples/function-str-ex2.js +0 -67
- package/oldExamples/trait1.js +0 -41
- package/oldExamples/trait2.js +0 -44
package/oldExamples/trait1.js
DELETED
|
@@ -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);
|
package/oldExamples/trait2.js
DELETED
|
@@ -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();
|