[JSMentors] Re: My jquery.observable library

2011-10-31 Thread Gildas
I agree that caching exceptions aren't maybe the best way to solve the problem. Dean Edwards wrote an article presenting a better alternative (I guess): http://dean.edwards.name/weblog/2009/03/callbacks-vs-events/ On 31 oct, 12:33, Jake Verbaten wrote: > -1 to catching exceptions. > > You do _N

Re: [JSMentors] Re: My jquery.observable library

2011-10-31 Thread Jake Verbaten
-1 to catching exceptions. You do _NOT_ want exceptions to be "magically eaten" by your event system. Unless you write a decent error handling API into the system you should not do this. On Mon, Oct 31, 2011 at 11:31 AM, Gildas wrote: > Some other remarks : > - undefined isn't protected > - I t

[JSMentors] Re: My jquery.observable library

2011-10-31 Thread Gildas
Some other remarks : - undefined isn't protected - I think the fireEvent function should catch execpetions when calling Function.prototype.call. It ensures that a failing listener won't prevent the other listeners to work. On 30 oct, 12:40, Bence Erős wrote: > Hello, > > thank you Gildas, I fixed

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Jake Verbaten
Why use underscore when you can use the ES5-shim. On Sun, Oct 30, 2011 at 9:35 PM, Nick Morgan wrote: > On 30 October 2011 12:37, Jake Verbaten wrote: > >> No, you don't need underscore. You need ES5. >> >> `Array.isArray` >> >> and >> >> `typeof o === "object" && o !== null` >> >> >> > Meanwhi

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Nick Morgan
On 30 October 2011 12:37, Jake Verbaten wrote: > No, you don't need underscore. You need ES5. > > `Array.isArray` > > and > > `typeof o === "object" && o !== null` > > > Meanwhile, back in the real world, he needs underscore :) [Most of what underscore gives you is features from ES5, but if you'r

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Arian Stolwijk
For those two methods you don't need a lib at all. On Sun, Oct 30, 2011 at 1:23 PM, Nick Morgan wrote: > > > On 30 October 2011 11:52, Bence Erős wrote: > >> Hello Jake, >> >> I implemented it as a jQuery plugin because it uses jQuery.isArray() and >> jQuery.isPlainObject(), that's all. It can

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Nick Morgan
On 30 October 2011 11:52, Bence Erős wrote: > Hello Jake, > > I implemented it as a jQuery plugin because it uses jQuery.isArray() and > jQuery.isPlainObject(), that's all. It can be simply made > jQuery-independent. > > > I'd recommend Underscore.js for those functions. Much more lightweight, an

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Arian Stolwijk
var isArray = Array.isArray || function(object){ return {}.toString.call(object) == '[object Array]'; }; Looking at the code, it's not really hard to remove the strict check of isPlainObject, and work around that. On Sun, Oct 30, 2011 at 12:52 PM, Bence Erős wrote: > Hello Jake, > > I impl

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Bence Erős
Hello Jake, I implemented it as a jQuery plugin because it uses jQuery.isArray() and jQuery.isPlainObject(), that's all. It can be simply made jQuery-independent. regards, Bence 2011/10/30 Jake Verbaten > I would mention, ew why does it rely on jQuery but hey, that's popular > these days ¬_¬ >

Re: [JSMentors] Re: My jquery.observable library

2011-10-30 Thread Bence Erős
Hello, thank you Gildas, I fixed the coding style, JSHint currently doesn't report any warnings. Raynos, I replied to your issues on github. thanks again for both of you, Bence 2011/10/29 Gildas > Hi Bence, > > First, I'll recommend you to use a code quality tool like jshint. It > really helps

[JSMentors] Re: My jquery.observable library

2011-10-29 Thread Gildas
Hi Bence, First, I'll recommend you to use a code quality tool like jshint. It really helps to fix common bugs like undeclared variables (e.g. "comparator"). The report is here: http://www.jshint.com/reports/50009 On 29 oct, 18:41, Bence Erős wrote: > Hello JS Mentors, > > this is my first mail