Hello,

Code JavaScript:
 
var myObj = {
 
  event: document.onkeypress=function(e){
        var e=window.event || e;
        return e;
  }
 
  test1: function(param) {
  	//do something using this.event	
        if(this.event==...) {
        //...
        }
  }
 
 test2: function(param) {
  	//do something using this.event	
  }
 
  //...
}

As you can see, I'm trying to build an object which will have to use an event listener. I really don't know if I'm going the right way with it amd am seeking some advice.

The object would be used like that:
Code:
if(myObj.test1(param)===true){
	//do something
}
if(myObj.test2(param)===true){
	//do something
}
How should this situation be handled? Should I use an event binder? If yes, how?