assets/distil.js in distil-0.13.6 vs assets/distil.js in distil-0.14.0.b

- old
+ new

@@ -151,11 +151,11 @@ throw new Error("Couldn't determine path from script src: " + url); return { type: type, url: url, - callback: callback, + callbacks: callback ? [callback]: [], scope: scope, userData: userData, loadQueue: [], fetched: false, injected: false, @@ -215,12 +215,12 @@ injectResource(resource); return; } resource.callbacksExecuted= true; - if (resource.callback) - resource.callback.call(resource.scope, resource.userData); + while (resource.callbacks.length) + (resource.callbacks.shift()).call(resource.scope, resource.userData); resource= resource.parent; } currentResource= resource ? resource : rootResource; @@ -330,11 +330,11 @@ distil.onready= function(callback) { if (rootResource.callbacksExecuted) window.setTimeout(callback, 0); else - rootResource.callback= callback; + rootResource.callbacks.push(callback); } distil.complete= function(name) { var module= moduleIndex[name]; @@ -371,28 +371,30 @@ if (rootResource===currentResource) injectionComplete(currentResource); } - distil.kick= function() + distil.moduleDidLoad= function(moduleName) { if (rootResource===currentResource) injectionComplete(currentResource); } + distil.kick= distil.moduleDidLoad; + distil.urlForAssetWithNameInModule= function(asset, moduleName) { - var module= moduleName ? moduleIndex[moduleName] : distil.mainModule; + var module= name ? moduleIndex[moduleName] : distil.mainModule; if (!module) throw new Error(NO_MODULE_ERROR + moduleName); if (!module.asset_map) return module.path + asset; return module.path + (module.asset_map[asset]||asset); } distil.dataForAssetWithNameInModule= function(asset, moduleName) { - var module= moduleName ? moduleIndex[moduleName] : distil.mainModule; + var module= name ? moduleIndex[moduleName] : distil.mainModule; if (!module) throw new Error(NO_MODULE_ERROR + moduleName); if (!module.assets) return null; return module.assets[asset]||null;