Also ging ich voran & kopiert im Grunde die Dojo AddOnLoad Funktionen & hat es zu meiner Klasse hinzugefügt. Es scheint zu funktionieren. Ich habe versucht, ein Pub/Sub oder Dojo.connect zu machen, aber ich denke, das war die sauberste und erkennbarste Lösung.
Im Folgenden sind die erforderlichen Bits, um es geht, wieder aus dojo.js gestrippt und in meine Klasse gesteckt:
_onto : function(arr, obj, fn){
if(!fn){
arr.push(obj);
}else if(fn){
var func = (typeof fn == "string") ? obj[fn] : fn;
arr.push(function(){ func.call(obj); });
}
},
_loaded : function() {
this._loadNotifying = true;
this._postLoad = true;
var mll = this._loaders;
for(var x = 0; x < mll.length; x++){
try{
mll[x]();
}catch(e){
throw e;
console.error("addOnLoad callback failed: " + e, e); /* let other load events fire, like the parser, but report the error */
}
}
this._loadNotifying = false;
//Make sure nothing else got added to the onload queue
//after this first run. If something did, and we are not waiting for any
//more inflight resources, run again.
if(this._postLoad && this._inFlightCount == 0 && mll.length){
this._loaded();
}
},
addOnLoad : function(/*Object?*/obj, /*String|Function?*/functionName){
this._onto(this._loaders, obj, functionName);
if(this._postLoad && !this._loadNotifying){
this._loaded();
}
}
Maine, danke für das klare Beispiel. Ich werde immer noch AddOnLoaded als Einstiegspunkt verwenden, sondern nur dojo.connect() aufrufen. – olore