when using call, failing to pass a first argument, it will bind this to the
null.
you don't need both bind and call. Also, you can simply call fn:

http://jsfiddle.net/4ZzLs/

On Mon, Sep 6, 2010 at 12:27 PM, berlinsurfer <[email protected]>wrote:

> Hi,
> a short question: is there a possibility to store this.previous()
> (when refatoring a Class) within another function ?
> This throws an error:
> Request.HTML = Class.refactor(Request.HTML, {
> ...,
> onSomethingElse: function() {
> var fn = function () {this.previous()}.bind(this);
> fn.call();
> }
> });
>
> It says this.previous() is undefined. Why ? Even when logging "this"
> via console.log, this.previous is marked as undefined. When calling it
> directly it works however. Very strange to me...
> Cheers,
> Jan
>



-- 
Arieh Glazer
אריה גלזר
052-5348-561
5561

Reply via email to