joshuagruenstein / snooze

A lightweight JS front-end microframework for API-first webapps.
MIT License
1 stars 0 forks source link

Reactive pipes #10

Closed joshuagruenstein closed 8 years ago

joshuagruenstein commented 8 years ago

Currently, pipes are polled on a schedule. It would be cool if pipes could be polled whenever a change occurs or is expected. This would be especially useful for wrapped-object pipes, kinda arbitrary for function pipes, and tricky for HTTP pipes (although I'm sure something hacky could be figured out). However, it would make snooze a very powerful framework, and mimic the instant data binding that occurs in the other direction with states and models.

joshuagruenstein commented 8 years ago

Part of me feels like I'm building an angular-react frankenhybrid.

joshuagruenstein commented 8 years ago

I think my solution to this will be to decrease the average polling period for object-sourced pipes. From my perspective, "pure" reactive behavior is a pipe dream (get it?).

joshuagruenstein commented 8 years ago

In commit eb30c2aee864d1197383d220a69d61e7393ccb55 I added some fixes to make this a tad nicer. Pipes are now objects with types, but that's not important. What's important is that the default refresh time is lower for objects now. Truth be told, frameworks like angular and react have made me think this is important, but I can't think of a single webapp I've made where I actually needed this kind of behavior. Filling a div with text from an input may be great for a demo, but it's not what snooze does best, and that's ok, because that's not what it should to do best. The point of a framework is to make complex webapp development easier, not to entrap new developers with shiny one liners.