Skip to content

Commit

Permalink
Simple adjust to the class model in order to improve readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
renatopp committed Jul 10, 2015
1 parent e192523 commit f3db269
Show file tree
Hide file tree
Showing 27 changed files with 3,233 additions and 3,673 deletions.
3,520 changes: 1,650 additions & 1,870 deletions libs/behavior3-0.2.0.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/behavior3-0.2.0.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/_docs/b3.js
@@ -1,5 +1,6 @@
/**
* # Behavior3JS
* Behavior3JS
* ===========
*
* * * *
*
Expand All @@ -18,9 +19,9 @@
* - Several **composite, decorator and action nodes** available within the
* library. You still can define your own nodes, including composites and
* decorators;
* - **Completely free**, the core module and the visual editor are all published
* under the MIT License, which means that you can use them for your open source
* and commercial projects;
* - **Completely free**, the core module and the visual editor are all
* published under the MIT License, which means that you can use them for
* your open source and commercial projects;
* - **Lightweight**!
*
* Visit http://behavior3.com to know more!
Expand Down
44 changes: 18 additions & 26 deletions src/actions/Error.js
@@ -1,5 +1,3 @@
this.b3 = this.b3 || {};

(function() {
"use strict";

Expand All @@ -10,30 +8,24 @@ this.b3 = this.b3 || {};
* @class Error
* @extends Action
**/
var Error = b3.Class(b3.Action);

var p = Error.prototype;

/**
* Node name. Default to `Error`.
*
* @property name
* @type {String}
* @readonly
**/
p.name = 'Error';

/**
* Tick method.
*
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.ERROR`.
**/
p.tick = function(tick) {
return b3.ERROR;
};
b3.Error = b3.Class(b3.Action, {

b3.Error = Error;
/**
* Node name. Default to `Error`.
* @property {String} name
* @readonly
**/
name: 'Error',

/**
* Tick method.
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.ERROR`.
**/
tick: function(tick) {
return b3.ERROR;
}
});

})();
46 changes: 19 additions & 27 deletions src/actions/Failer.js
@@ -1,5 +1,3 @@
this.b3 = this.b3 || {};

(function() {
"use strict";

Expand All @@ -9,30 +7,24 @@ this.b3 = this.b3 || {};
* @class Failer
* @extends Action
**/
var Failer = b3.Class(b3.Action);

var p = Failer.prototype;

/**
* Node name. Default to `Failer`.
*
* @property name
* @type {String}
* @readonly
**/
p.name = 'Failer';

/**
* Tick method.
*
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.FAILURE`.
**/
p.tick = function(tick) {
return b3.FAILURE;
};

b3.Failer = Failer;
b3.Failer = b3.Class(b3.Action, {

/**
* Node name. Default to `Failer`.
* @property {String} name
* @readonly
**/
name: 'Failer',

/**
* Tick method.
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.FAILURE`.
**/
tick: function(tick) {
return b3.FAILURE;
},
});

})();
44 changes: 18 additions & 26 deletions src/actions/Runner.js
@@ -1,5 +1,3 @@
this.b3 = this.b3 || {};

(function() {
"use strict";

Expand All @@ -9,30 +7,24 @@ this.b3 = this.b3 || {};
* @class Runner
* @extends Action
**/
var Runner = b3.Class(b3.Action);

var p = Runner.prototype;

/**
* Node name. Default to `Runner`.
*
* @property name
* @type {String}
* @readonly
**/
p.name = 'Runner';

/**
* Tick method.
*
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.RUNNING`.
**/
p.tick = function(tick) {
return b3.RUNNING;
};
b3.Runner = b3.Class(b3.Action, {

b3.Runner = Runner;
/**
* Node name. Default to `Runner`.
* @property {String} name
* @readonly
**/
name: 'Runner',

/**
* Tick method.
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.RUNNING`.
**/
tick: function(tick) {
return b3.RUNNING;
}
});

})();
42 changes: 17 additions & 25 deletions src/actions/Succeeder.js
@@ -1,5 +1,3 @@
this.b3 = this.b3 || {};

(function() {
"use strict";

Expand All @@ -9,30 +7,24 @@ this.b3 = this.b3 || {};
* @class Succeeder
* @extends Action
**/
var Succeeder = b3.Class(b3.Action);

var p = Succeeder.prototype;
b3.Succeeder = b3.Class(b3.Action, {

/**
* Node name. Default to `Succeeder`.
*
* @property name
* @type String
* @readonly
**/
p.name = 'Succeeder';

/**
* Tick method.
*
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.SUCCESS`.
**/
p.tick = function(tick) {
return b3.SUCCESS;
};
/**
* Node name. Default to `Succeeder`.
* @property {String} name
* @readonly
**/
name: 'Succeeder',

b3.Succeeder = Succeeder;
/**
* Tick method.
* @method tick
* @param {b3.Tick} tick A tick instance.
* @return {Constant} Always return `b3.SUCCESS`.
**/
tick: function(tick) {
return b3.SUCCESS;
}
});

})();

0 comments on commit f3db269

Please sign in to comment.