2 ms·
Great stuff: we do ad-hock versions of this in a few of our applications. It deserves a formalization. In my brief thinking about this, one potential version
by carsongross 13y ago
Great stuff: we do ad-hock versions of this in a few of our applications. It deserves a formalization.
In my brief thinking about this, one potential version would use HTML 5 attributes like AngularJS, but use HTTP/restful endpoints as "the model". I can imagine a few different approaches, but something like:
<div data-dyna-src="http://myserver/my-div-endpoint" http://myserver/my-div-endpoint" data-dyna-method="poll 500ms">
...
</div>
Which would then poll the given endpoint and swap in new content in a pluggable-but-visually-pleasing manner. http://myserver/my-div-endpoint http://myserver/my-div-endpoint would serve up the partial of the div, so everything would be DRY. Basically move the model back to the server, but still buff up the presentation layer a bit.
You'd probably need a few different patterns: updateable divs, forms, updatable tables, progress bars, as well as some good default transitions and, of course, make the whole thing pluggable, and potentially provide for both HTML and script interchange at the end point (that's what our ad-hoc version does: it provides a data channel, an html channel and a raw script channel, but it feels like a hack.)
Anyway, if anything is going to save us from the oncoming javascript-filled dystopian hellscape, it's probably something like this.