好的,我有一些类似的代码......
Thing function () {
var img = new Image;
DoSomeStuff function() {
//Some stuff here that can't be done until my img is loaded...
};
InitMe function(src) {
this.img.onLoad = this.DoSomeStuff;
this.img.src = src;
};
}
var Test = new Thing();
Test.InitMe("some string");
这显然行不通,因为this.DoSomeStuff
停止存在Thing.DoSomeStuff
并变成img.DoSomeStuff
所以我想我需要知道的是,我怎样才能从...调用Thing.DoSomeStuff()
函数。img.onLoad