Browse Source

on_load -> onLoad

v0.7.4-release
Ryan 16 years ago
parent
commit
d105d88625
  1. 14
      src/main.js
  2. 5
      test/test-file-open.js
  3. 2
      test/test-setTimeout.js
  4. 2
      test/test-test.js

14
src/main.js

@ -72,18 +72,18 @@ node.path = new function () {
function Scaffold (source, filename, module) {
// wrap the source in a strange function
var source = "function (__filename) {"
+ " var on_load;"
+ " var onLoad;"
+ " var exports = this;"
+ " var require = this.__require;"
+ " var include = this.__include;"
+ source
+ " this.__on_load = on_load;"
+ " this.__onLoad = onLoad;"
+ "};"
;
// returns the function
var compiled = node.compile(source, filename);
if (module.__on_load) {
if (module.__onLoad) {
//node.debug("<"+ filename+"> has onload! this is bad");
}
@ -103,11 +103,11 @@ node.path = new function () {
this.filename = filename;
this.module = module;
this.subs = module.__subs;
this.on_load = module.__on_load;
this.onLoad = module.__onLoad;
// remove these references so they don't get exported.
delete module.__subs;
delete module.__on_load;
delete module.__onLoad;
delete module.__require;
delete module.__include;
}
@ -125,9 +125,9 @@ node.path = new function () {
function finish() {
//node.debug("finish 1 load <" + filename + ">");
if (scaffold.on_load instanceof Function) {
if (scaffold.onLoad instanceof Function) {
//node.debug("foo bar <" + filename + ">");
scaffold.on_load();
scaffold.onLoad();
}
//node.debug("finish 2 load <" + filename + ">");

5
test/test-file-open.js

@ -1,8 +1,9 @@
include("mjsunit");
var assert_count = 0;
function onload () {
var fixtures = node.path.join(script.dirname, "fixtures");
function onLoad () {
var dirname = node.path.dirname(__filename);
var fixtures = node.path.join(dirname, "fixtures");
var x = node.path.join(fixtures, "x.txt");
file = new File;

2
test/test-setTimeout.js

@ -1,6 +1,6 @@
include("mjsunit");
function on_load () {
function onLoad () {
assertInstanceof(setTimeout, Function);
var starttime = new Date;

2
test/test-test.js

@ -1,7 +1,7 @@
include("mjsunit");
var a = require("fixtures/a");
function on_load () {
function onLoad () {
assertFalse(false, "testing the test program.");
assertInstanceof(a.A, Function);

Loading…
Cancel
Save