I'm working with MooTools and I have a problem with a callback function. This is a little exemple:
function func1(callback){
var event = 'something';
callback(event);
}
function func2(data){
}
var Obj = new Class({
initialize: function(){
this.data = "data";
//there I want to use func1 and use func2 as callback and this.data as argument of func2
}
});
So I try
func1(function(){
func2(this.data);
});
But I can't use this.data in an anonymous function because this is not the same context.
And
func1(func2)
This didn't works because I can't pass this.data as argument.
This is juste a simple exemple, func1 comes from a library so I can't edit it.
func1take two arguments, the data and the callback?