Prototype with a callback problem
- by Lisio
function Foo() {
this.bar = false;
}
Foo.prototype={
onLoad: function() {
this.bar=true;
},
create: function(id) {
SomeClass.someMethod({
id: id,
onWorkIsDone: this.onLoad
});
}
};
var temp=new Foo();
temp.create();
This sample has a logic error in string 'onWorkIsDone: this.onLoad'. What I have to place instead of 'this.onLoad' to make SomeClass call exactly the temp.onLoad method when it finishes it's work?