mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 22:51:28 +00:00
Changed #define from RHINO to COMMONJS. Re-enabled recently added document-load-waiting.
Reviewed by me.
This commit is contained in:
@@ -13,11 +13,33 @@ rootNode.resolveSubPath(cwd, StaticResourceNode.DirectoryType, function(cwdNode)
|
||||
|
||||
for (; index < count; ++index)
|
||||
cwdNode.nodeAtSubPath(FILE.normal(includePaths[index]), YES);
|
||||
#ifndef RHINO
|
||||
#ifdef BROWSER
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
|
||||
fileImporterForPath(FILE.join(cwd, "main.j"))("main.j", YES, function()
|
||||
{
|
||||
console.log(rootNode.toString(true));
|
||||
console.log("done.");
|
||||
afterDocumentLoad(main);
|
||||
});
|
||||
#endif
|
||||
});
|
||||
});
|
||||
|
||||
#ifdef BROWSER
|
||||
function afterDocumentLoad(/*Function*/ aFunction)
|
||||
{
|
||||
if (documentLoaded)
|
||||
return aFunction();
|
||||
|
||||
if (window.addEventListener)
|
||||
window.addEventListener("load", aFunction, false);
|
||||
|
||||
else if (window.attachEvent)
|
||||
window.attachEvent("onload", aFunction);
|
||||
}
|
||||
|
||||
var documentLoaded = NO;
|
||||
|
||||
afterDocumentLoad(function()
|
||||
{
|
||||
documentLoaded = YES;
|
||||
});
|
||||
#endif
|
||||
|
||||
@@ -43,8 +43,8 @@ function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*String*/ aSc
|
||||
|
||||
var code = this._code;
|
||||
|
||||
#if RHINO
|
||||
code = "function(\"" + this.functionParameters().join("\",\"" + "\"){" + code + "/**/\n}";
|
||||
#if COMMONJS
|
||||
code = "function(" + this.functionParameters().join(" , ") + "){" + code + "/**/\n}";
|
||||
|
||||
if (typeof system !== "undefined" && system.engine === "rhino")
|
||||
this._function = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, code, this._scope, 0, null);
|
||||
|
||||
@@ -88,7 +88,11 @@ CLOBBER.include($BUILD_OBJECTIVE_J);
|
||||
|
||||
function environmentFlags()
|
||||
{
|
||||
return "-DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment) {
|
||||
return Array.prototype.map.apply(arguments, [function(anEnvironment)
|
||||
{
|
||||
return "-D" + anEnvironment.toUpperCase();
|
||||
}]).join(" ") +
|
||||
" -DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment) {
|
||||
return "\\\"" + anEnvironment + "\\\"";
|
||||
}]).join(", ") + "]\"";
|
||||
}
|
||||
|
||||
@@ -114,10 +114,14 @@ function fileImporterForPath(/*String*/ referencePath)
|
||||
fileExecutable.addEventListener("dependenciesload", function()
|
||||
{
|
||||
fileExecuter(aPath, isLocal);
|
||||
aCallback();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
fileExecuter(aPath, isLocal);
|
||||
aCallback();
|
||||
}
|
||||
}
|
||||
|
||||
if (fileExecutableSearch.isComplete())
|
||||
|
||||
Reference in New Issue
Block a user