Well looking at the bindWithEvent method and the bin method i really cant
see the issue and why it was removed. I have updated my Function.bind method
to this
bind: function(bind, args){
var self = this
return function(event){
if (event && args && arguments.length) return
self.apply(bind, (args == null) ? arguments : [event].concat(args));
if (!args && !arguments.length) return self.call(bind);
if (args && arguments.length) return self.apply(bind,
args.concat(Array.from(arguments)));
return self.apply(bind, args || arguments);
};
},
This will handle both binding events and binding normal stuff........unless
i have missed something? It is basically merging the 2 methods together
From: Sean McArthur [mailto:[email protected]]
Sent: Wednesday, 9 February 2011 4:13 PM
To: [email protected]
Subject: Re: [Moo] Binding with events
My other suggestion is to find a Function.prototype.curry method, and use
curry and bind. That's all bindWithEvent essentially did anyways.
myEl.addEvent('click', this.someMethod.curry('foo').bind(this));
On Tue, Feb 8, 2011 at 8:29 PM, Steve Onnis <[email protected]> wrote:
As much as that might work, its not very elegant. If i am going to do that i
may as well just add the bindWithEvent method back into the code base
Thanks though
From: Sean McArthur [mailto:[email protected]]
Sent: Wednesday, 9 February 2011 3:21 PM
To: [email protected]
Subject: Re: [Moo] Binding with events
var that = this;
myEl.addEvent('click', function(evt) {
that.myMethod(evt, 'foo');
});
On Tue, Feb 8, 2011 at 7:55 PM, Steve Onnis <[email protected]> wrote:
Thanks for that...but doesn't answer the question unless you are saying that
the only way to do it is to actually add the bindWithEvent function back
into the codebase somewhere? Is it not possible with just bind ?
-----Original Message-----
From: Sanford Whiteman [mailto:[email protected]]
Sent: Wednesday, 9 February 2011 2:45 PM
To: Steve Onnis
Subject: Re: [Moo] Binding with events
Roman opened the thread "BindWithEvent deprecated?" -- search the
archives.
-- S.
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16860)
http://www.pctools.com/
=======
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16860)
http://www.pctools.com/
=======
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16860)
http://www.pctools.com <http://www.pctools.com/?cclick=EmailFooterClean_51>
=======
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16860)
http://www.pctools.com <http://www.pctools.com/?cclick=EmailFooterClean_51>
=======
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16860)
http://www.pctools.com <http://www.pctools.com/?cclick=EmailFooterClean_51>
=======
=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16860)
http://www.pctools.com/
=======