News for hackers. Stuff that matters.
Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by Kiro on Thursday August 14, 2014 @06:20AM (#8176781)
Looks very straight-forward. Good job!

OT: After building a couple of large applications in Angular I've come to realize that I seldom need two-way bindings. The school example where you enter something in an input box and it shows up somewhere else in real-time is not really used in the real world. Or is it? Why do we need two-way data binding?

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by AndrewDucker on Thursday August 14, 2014 @06:47AM (#8176844)
I rarely need _simultaneous_ two-way databinding.

But I do sometimes need databinding from view to model (when I want users to enter data, and it just fills in my object), and I sometimes want databinding from model to view (where my data is nicely displayed).

So rather than doing something fiddly and different for each way, it makes more sense to just have 2-way databinding in the first place.

And that then makes it easier for when I _do_ want 2-way databinding - for instance allowing users to enter a filter to narrow down a list.

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by itry on Thursday August 14, 2014 @07:16AM (#8176917)
> allowing users to enter a filter

Wouldn't it be enough to add a keydown event to the field?

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by nitrogen on Thursday August 14, 2014 @08:10AM (#8177053)
Two-way data binding is needed for audio hardware controls that are linked to multiple inputs or to other controls (e.g. a volume control with both a text input and a slider, possibly linked to another volume control from a different channel).
Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by UweSchmidt on Thursday August 14, 2014 @06:42AM (#8176830)
How about: Enter an amount in an input box and see a sub-total in real-time, or alert when constraints are violated?

Possibilities are endless and you're more likely to implement them when it is so painless.

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by itry on Thursday August 14, 2014 @07:21AM (#8176933)
Is it really more painless to add way.js and its dependencies (jquery.js, underscore.js, underscore.json.js, form2js.js and js2form.js) to your page then to simply add a plain javascript eventhandler to the field you want to validate?
Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by jcrotor on Thursday August 14, 2014 @07:35AM (#8176963)
That depends. How many forms and how many fields do you need to validate? jQuery is pretty much standard on most websites, so I don't count that against the author. The total minified dependency file is 123 kb. I will agree that is pretty large if all you are using it for is a single field, but again, a large portion of that is jquery. Also compared to just core angular, which is 104 kb, I would say this is a viable alternative depending of course on your specific use cases.

That being said, could an implementation be done without jQuery? Probably. I'm sure the author is open to pull requests if you want to give it a go.

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by itry on Thursday August 14, 2014 @08:07AM (#8177047)
Well, you can argue if 5 dependencies and 123 kilobytes of code is much or not. But what does it bring to the table? Your "sub-total" example would just need a normal javascript event handler. Lets say we are uber lazy and use jquery. Then it looks like this:

http://jsfiddle.net/La93vk4q/

How does the way.js version look like? Im sceptical it makes it more elegant.

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by nissimk on Thursday August 14, 2014 @09:21AM (#8177268)
I'm with you itry. Thanks for bringing this up here. These folks all want to avoid writing event handlers but these alternatives just make there be many levels of function calls between that actual user event and the developer's code to handle it. In addition to it being much slower, it's a lot harder to figure out what's happening when something goes wrong.
Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by UweSchmidt on Thursday August 14, 2014 @03:40PM (#8179427)
I guess it depends :)

I'm using Angular's databinding and recently it felt as if it was just convenient enough to implement a nice-to-have feature that I might have postponed otherwise.

I'm also careful with adding too many dependencies for simple things. But since I've committed to learning and using Angular anyways, I don't mind the weight and like using what it has to offer.

Re:Show HN: Way.js – Simple, persistent, framework-agnostic ... by progx on Thursday August 14, 2014 @06:26AM (#8176792)
It depend on your application.

Collaboration applications need it.