initial commit
This commit is contained in:
commit
4b60ece582
327 changed files with 28286 additions and 0 deletions
29
libjs/wTest/test.js
Normal file
29
libjs/wTest/test.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
var Class = require("../utils/subscribable");
|
||||
|
||||
var Test = Class.inherit({
|
||||
"className": "Test",
|
||||
"constructor": function(name) {
|
||||
Class.fn.constructor.call(this);
|
||||
|
||||
this._name = name;
|
||||
this._actions = [];
|
||||
},
|
||||
"run": function() {
|
||||
this.trigger("start", this._name);
|
||||
var succsess = this._actions.length;
|
||||
for (var i = 0; i < this._actions.length; ++i) {
|
||||
this.trigger("progress", this._name, i + 1, this._actions.length);
|
||||
try {
|
||||
this._actions[i].call(this);
|
||||
} catch (e) {
|
||||
this.trigger("fail", this._name, i + 1, e);
|
||||
--succsess;
|
||||
}
|
||||
}
|
||||
this.trigger("end", this._name, succsess, this._actions.length);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Test;
|
Loading…
Add table
Add a link
Reference in a new issue