fix loading

it appears that modules with a shutdown cause a load failure ???
This commit is contained in:
Joe Walker 2010-11-23 13:29:26 +00:00
commit 504acb230c
3 changed files with 40 additions and 21 deletions

View file

@ -37,12 +37,14 @@
define(function(require, exports, module) { define(function(require, exports, module) {
var console = require('util/console'); var console = require('pilot/console');
var Trace = require('util/stacktrace').Trace; var Trace = require('pilot/stacktrace').Trace;
var Event = require('events').Event; //var Event = require('events').Event;
var history = require('canon/history');
exports.startup = function(data, reason) { exports.startup = function(data, reason) {
if (!data.env || !data.env.settings) {
return;
}
var settings = data.env.settings; var settings = data.env.settings;
// TODO register these using new registration functionality // TODO register these using new registration functionality
@ -89,7 +91,7 @@ exports.Canon.prototype = {
} }
}; };
exports.addedRequestOutput = new Event(); // exports.addedRequestOutput = new Event();
/** /**
* Current requirements are around displaying the command line, and provision * Current requirements are around displaying the command line, and provision
@ -188,7 +190,7 @@ exports.Request = function(options) {
this.completed = false; this.completed = false;
this.error = false; this.error = false;
this.changed = new Event(); // this.changed = new Event();
}; };
/** /**
@ -199,7 +201,7 @@ exports.Request.prototype._beginOutput = function() {
this._begunOutput = true; this._begunOutput = true;
this.outputs = []; this.outputs = [];
history.addRequestOutput(this); exports.addRequestOutput(this);
}; };
/** /**

View file

@ -35,17 +35,34 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) { var deps = [
"pilot/fixoldbrowsers",
"pilot/types/basic",
"pilot/canon"
];
exports.startup = function(data, reason) { var packages = deps.slice();
require("fixoldbrowsers").startup(data, reason); packages.unshift("require", "exports", "module");
require("types/basic").startup(data, reason);
require("canon").startup(data, reason);
};
exports.shutdown(data, reason) { define(packages, function(require, exports, module) {
require("fixoldbrowsers").shutdown(data, reason);
require("types/basic").shutdown(data, reason); exports.startup = function(data, reason) {
require("canon").shutdown(data, reason); deps.forEach(function(dep) {
}; console.log("test startup for " + dep);
var module = require(dep);
if (typeof module.startup === "function") {
module.startup(data, reason);
}
});
};
/*
exports.shutdown(data, reason) {
deps.forEach(function(dep) {
var module = require(dep);
if (typeof module.shutdown === "function") {
module.shutdown(data, reason);
}
});
};
*/
}); });

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) { define(function(require, exports, module) {
var types = require("types"); var types = require("pilot/types");
/** /**
* These are the basic types that we accept. They are vaguely based on the * These are the basic types that we accept. They are vaguely based on the