Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Remove 'new' keyword when creating a can.Observe

$
0
0
I'm not taking issue with the implementation of can.Observe. I fully understand what you all are saying about how these objects are composed. My problem i'm sure goes away after accumulating some experience with canJS, but at first glance, you have all these namespaced object builders that look the same, and almost all function the same (by extending the prototype), except for ONE constructor that works slightly differently.

I might just be fixating too much on the naming of things. I know there have been a few threads about this already so I don't want to beat a dead horse. 

As an analogy, imagine the jquery shortcut events (click, change, load, keypress, focus etc.) the way they are now. Now think if they all worked the same using $(el).<eventname>(callback), except for click which would always require 'new' as in 

  1. var clicker = new $.click(el, callback). 

That would cause more than a few headaches to beginners. 

I don't really have any suggestions for how to improve things. I could create my own local object to do what I want, but that might break context and the prototype chain.

Viewing all articles
Browse latest Browse all 3491

Trending Articles