I found the solution: I had to use apply instead. See the jsfiddle: http://jsfiddle.net/TfhL8/1/ Thanks, Jan
On 6 Sep., 11:52, berlinsurfer <[email protected]> wrote: > Thanks, Arieh, > but that's not what I wanted to achieve. "This.previous" is referring > to the old function "doSomething". To make it > clearer:http://jsfiddle.net/TfhL8/ > > On 6 Sep., 11:42, אריה גלזר <[email protected]> wrote: > > > 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
