1 dump('entering util/exec.js\n');
3 if (typeof util == 'undefined') var util = {};
4 util.exec = function() {
5 JSAN.use('util.error');
6 this.error = new util.error();
11 util.exec.prototype = {
12 // This executes a series of functions, but tries to give other events/functions a chance to
13 // execute between each one.
14 'chain' : function () {
17 for (var i = 0; i < arguments.length; i++) {
18 var arg = arguments[i];
19 switch(arg.constructor.name) {
24 for (var j = 0; j < arg.length; j++) {
25 if (typeof arg[j] == 'function') args.push( arg[j] );
30 if (typeof arg[j] == 'function') args.push( arg[j] );
35 if (args.length > 0) setTimeout(
39 if (args.length > 1 ) obj.chain( args.slice(1) );
41 this.error('D_EXEC','util.exec.chain broken: ' + E);
42 if (typeof obj.on_error == 'function') {
51 dump('exiting util/exec.js\n');