Prototype with a callback problem
Posted
by
Lisio
on Stack Overflow
See other posts from Stack Overflow
or by Lisio
Published on 2010-12-21T19:58:14Z
Indexed on
2010/12/22
0:54 UTC
Read the original article
Hit count: 119
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?
© Stack Overflow or respective owner