Skip to content

Commit

Permalink
fix ariatemplates#286 improve ScriptLoader doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-g committed Dec 14, 2012
1 parent a0ed83e commit 244c888
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/aria/utils/ScriptLoader.js
Expand Up @@ -14,7 +14,9 @@
*/

/**
* Utility to load external scripts
* Utility to load external scripts. Please do NOT use it for loading Aria Templates classes (the ones that use
* <code>Aria.classDefinition()</code>) and templates. Use <code>Aria.load()</code> instead, which is capable of
* caching, resolving dependencies and reading multipart files containing templates.
*/
Aria.classDefinition({
$classpath : "aria.utils.ScriptLoader",
Expand All @@ -23,11 +25,11 @@ Aria.classDefinition({
$constructor : function () {
this._queueIndex = 0;
this._queueCount = {};
this._loadedSripts = [];
this._loadedScripts = [];
},
$destructor : function () {
this._queueCount = null;
this.loadedScripts = null;
this._loadedScripts = null;
},
$prototype : {

Expand All @@ -37,7 +39,7 @@ Aria.classDefinition({
* @param {Function} callback - A function to call once the whole set of scripts are loaded
*/
load : function (scripts, callback) {
var i, ii, url, scriptNode, scriptCount, loadedScripts = this._loadedSripts,
var i, ii, url, scriptNode, scriptCount, loadedScripts = this._loadedScripts,

queueIndex = this._queueIndex, document = Aria.$frameworkWindow.document,

Expand All @@ -63,7 +65,7 @@ Aria.classDefinition({
scriptCount++;
loadedScripts[url] = true;
scriptNode = document.createElement('script');
scriptNode.setAttribute("language", "javascript");
scriptNode.setAttribute("type", "text/javascript");
if (callback) {
this._addScriptLoadedCallback(scriptNode, onReadyStateChangeCallback, [queueIndex, scriptNode]);
}
Expand Down Expand Up @@ -105,4 +107,4 @@ Aria.classDefinition({
this._addScriptLoadedCallback.call(this, scriptNode, callback, callbackArgs);
}
}
});
});

0 comments on commit 244c888

Please sign in to comment.