Let object "invoke" function in JavaScript
<p>I wasn't sure of the title, but I hope you will be able to help me.</p>

<p>I want to use kinda the same pattern that jQuery uses for their event handlers, like click/hover/blur etc, where you use <code>this</code> inside the event handler to get the object.</p>

<p>How do I accomplish this?</p>

<pre><code>// The event handler
var handler = function() {
     alert(this); // how do I set "this" in the trigger?
}

// The function that triggers the event handler
var trigger = function(handler) {
     var o = someObject;
     if($.isFunction(handler)) handler(); // how do I set "o" as the this-reference in handler?
}
</code></pre>
