Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run : function (onEnd, scope, arg) {
// -------------------------------------- input arguments processing
if (!ariaUtilsType.isFunction(onEnd)) {
onEnd = Aria.empty;
}
if (scope == null) {
scope = this;
}
// ------------------------------------------------------ processing
// actual sequence creation ----------------------------------------
var sequence = new ariaCoreSequencer();
this._toDispose.push(sequence);
this.__sequence = sequence;
ariaUtilsArray.forEach(this.__tasks, function (task) {
ariaUtilsArray.forEach(specs, function (spec) {
if (spec.children == null) {
// task --------------------------------------------------------
sequence.addTask(this.task(spec));
} else {
// sequence ----------------------------------------------------
var children = spec.children;
if (ariaUtilsType.isString(children)) {
children = this.scope[children];
}
if (ariaUtilsType.isFunction(children)) {
children = children.apply(this.scope, spec.args || []);
}
sequence.addSequence(this.sequence(spec.name, children));
}
}, this);
this.args = args;
// callback > asynchronous ---------------------------------------------
var asynchronous = spec.asynchronous;
if (asynchronous == null) {
asynchronous = true;
}
asynchronous = !!asynchronous;
this.asynchronous = asynchronous;
// fn ------------------------------------------------------------------
var fn = spec.fn;
if (!ariaUtilsType.isFunction(fn)) {
throw Error('The function to be used by the task is not properly specified. Got: ' + fn);
}
this.fn = fn;
// trace ---------------------------------------------------------------
var trace = spec.trace;
this.trace = {};
if (ariaUtilsType.isObject(trace)) {
// trace > enable --------------------------------------------------
var enable = trace.enable;
if (enable == null) {
enable = trace.activate;
var scope = spec.scope;
if (scope == null) {
scope = registeredProperties.scope;
}
if (scope == null) {
scope = this.scope;
}
// fn (actual callback) --------------------------------------------
if (ariaUtilsType.isString(fn)) {
fn = scope[fn];
}
if (!ariaUtilsType.isFunction(fn)) {
throw new Error('Wrong function definition, got: ' + fn);
}
// asynchronous ----------------------------------------------------
var asynchronous = spec.asynchronous;
if (asynchronous == null) {
asynchronous = registeredProperties.asynchronous;
}
if (asynchronous == null) {
asynchronous = this.asynchronous;
}
asynchronous = !!asynchronous;
creator.call(this, function add(fnOrName) {
var fn;
if (ariaUtilsType.isString(fnOrName)) {
fn = self[fnOrName];
} else {
fn = fnOrName;
}
if (fn == null) {
throw new Error('The given value is not defined, cannot add any function.');
}
if (ariaUtilsType.isFunction(fn.async)) {
fn = fn.async;
}
if (arguments.length > 1) {
var boundArguments = Array.prototype.slice.call(arguments, 1);
fn = self._partializeAsynchronousFunction(fn, boundArguments);
}
sequence.push(fn);
});
moduleControllerLoaded : function (res) {
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinition));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinition));
this.assertTrue(typeof res.moduleCtrl == "object", "Instantiating generated Module didn't produce an object");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrlPrivate, "aria.my.great.test.ModuleDefinition"), "Instantiated object is not of the correct type");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrl, "aria.my.great.test.IModuleDefinition"), "Instantiated object is not of the correct type");
res.moduleCtrlPrivate.$dispose();
Aria.dispose("aria.my.great.test.ModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinitionFlow");
Aria.dispose("aria.my.great.test.ModuleDefinitionFlow");
this.notifyTestEnd("testAsyncModuleControllerClass");
},
moduleControllerLoaded : function (res) {
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinition));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinition));
this.assertTrue(typeof res.moduleCtrl == "object", "Instantiating generated Module didn't produce an object");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrlPrivate, "aria.my.great.test.ModuleDefinition"), "Instantiated object is not of the correct type");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrl, "aria.my.great.test.IModuleDefinition"), "Instantiated object is not of the correct type");
res.moduleCtrlPrivate.$dispose();
Aria.dispose("aria.my.great.test.ModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinitionFlow");
Aria.dispose("aria.my.great.test.ModuleDefinitionFlow");
this.notifyTestEnd("testAsyncModuleControllerClass");
},
moduleControllerLoaded : function (res) {
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinition));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinition));
this.assertTrue(typeof res.moduleCtrl == "object", "Instantiating generated Module didn't produce an object");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrlPrivate, "aria.my.great.test.ModuleDefinition"), "Instantiated object is not of the correct type");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrl, "aria.my.great.test.IModuleDefinition"), "Instantiated object is not of the correct type");
res.moduleCtrlPrivate.$dispose();
Aria.dispose("aria.my.great.test.ModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinitionFlow");
Aria.dispose("aria.my.great.test.ModuleDefinitionFlow");
this.notifyTestEnd("testAsyncModuleControllerClass");
},
moduleControllerLoaded : function (res) {
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinition));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.IModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinitionFlow));
this.assertTrue(ariaUtilsType.isFunction(aria.my.great.test.ModuleDefinition));
this.assertTrue(typeof res.moduleCtrl == "object", "Instantiating generated Module didn't produce an object");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrlPrivate, "aria.my.great.test.ModuleDefinition"), "Instantiated object is not of the correct type");
this.assertTrue(ariaUtilsType.isInstanceOf(res.moduleCtrl, "aria.my.great.test.IModuleDefinition"), "Instantiated object is not of the correct type");
res.moduleCtrlPrivate.$dispose();
Aria.dispose("aria.my.great.test.ModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinition");
Aria.dispose("aria.my.great.test.IModuleDefinitionFlow");
Aria.dispose("aria.my.great.test.ModuleDefinitionFlow");
this.notifyTestEnd("testAsyncModuleControllerClass");
},