The API could use some work. To implement the simplest example, I need to remember patterns like: > eventContract.dispatchTo(goog.bind(dispatcher.dispatch, dispatcher)); imho, there's a problem if you need to dust off your gang of four book to understand the API. Might as well include an AbstractSingletonProxyFactoryBean.
The API could certainly use some work, and it's worse than you mention. If it were just a matter of applying widely-known Gang of Four patterns it would be fine. All over the place it looks like the designer didn't realize there's a built-in Function.prototype.bind.
Google open-sources JsAction, a JavaScript event delegation library
31–40 of 48 posts
Re: Google open-sources JsAction, a JavaScript event delegation library
#32Interesting. This might have come from the Google+ development team, as this and something called "jsmodel" are part of that product. You can see traces of both of these in the DOM of plus.google.com
Actually you can also see traces of the jsaction attribute in the G+ product. G+ isn't using this from the group up though. It has a pretty long history at Google, so I'm not even sure where it came from. Should have been either Maps or Search.
Re: Google open-sources JsAction, a JavaScript event delegation library
#33Earlier quoted context omitted.
The API could certainly use some work, and it's worse than you mention. If it were just a matter of applying widely-known Gang of Four patterns it would be fine. All over the place it looks like the designer didn't realize there's a built-in Function.prototype.bind.
In IE8 and FF3.6, there isn't. If you believe netmarketshare.com, that's 20% of users right there.
Re: Google open-sources JsAction, a JavaScript event delegation library
#34Seems like this has to be "compiled" with clojure compiler. I'm not very familiar with this. Can someone provide some rough instructions to actually get the "compiled" library?
Re: Google open-sources JsAction, a JavaScript event delegation library
#35Earlier quoted context omitted.
Javascript, in a browser, exists to manipulate the document. If your opinion is that decoupling the elements of that document from the actions that might happen as a result of interacting with that element then so be it, but I couldn't disagree more. Even if it allows them to live in a "nicer" language (JS vs HTML), I'd rather everything be declared up front. Reading someone else's Backbone code (as compared to Angul…
> I'd rather everything be declared up front. I'm all for declaring up front, just not in html. > Reading someone else's Backbone code (as compared to Angular or Ember) is really, really not fun for me. Backbone is far from what I consider good readability. If encourages bad habits by not providing templating and sort of encouraging use of jQuery for dom modification. Binding events to backbone view is what I conside…
If you're a fan of backbone views though - why not React? IMO it's very similar to backbone but with sane structure and an incredibly powerful render loop.
Re: Google open-sources JsAction, a JavaScript event delegation library
#36So this (with specialized lib, and fairly large unintuitive js code to set whole thing up): is pretty much the same as this: without any abusing or manipulating of html and dom and with setup as simple and understandable as this: window.Actions = { leftNav: { clickAction: function() { myApp.LeftNav.doSomeSeriousStuff(); }, doubleClickAction: function() { // very late loading of implementation require("LeftNavActions"…
Re: Google open-sources JsAction, a JavaScript event delegation library
#37This seems pretty complicated and not so simple. Someone else asked, "How is this better than Backbone?" Backbone is (a lot) more than just an event lib. A better question would be, "How is this better than OnOff?" (which is basically the equivalent of the events part of Backbone): https://github.com/LiftoffSoftware/OnOff
Re: Google open-sources JsAction, a JavaScript event delegation library
#38I like they are putting this on Github instead of (or on top of) Google Code
Github is successfull because of git AND its good clean UX.
Google code feels like developpers were in charge of the UX. It's a UX disaster and will be retired sooner or later.
Re: Google open-sources JsAction, a JavaScript event delegation library
#39I like they are putting this on Github instead of (or on top of) Google Code
Re: Google open-sources JsAction, a JavaScript event delegation library
#40So this (with specialized lib, and fairly large unintuitive js code to set whole thing up): is pretty much the same as this: without any abusing or manipulating of html and dom and with setup as simple and understandable as this: window.Actions = { leftNav: { clickAction: function() { myApp.LeftNav.doSomeSeriousStuff(); }, doubleClickAction: function() { // very late loading of implementation require("LeftNavActions"…
I like the syntax, but it bugs me that the behaviour goes into the HTML. I really like keeping my event mapping in the javascript so I keep a clean separation between structure in the HTML and behaviour in the JS.