I like the sql’y syntax personally but I’d be fine with at:
, I like most of the current syntax actually, I know I had a few changes in mind (like removing jquery, jquery is really not necessary, everything can be done with vanilla js pretty easily except some really odd selectors, of which there are better ways anyway) but I don’t remember most at the moment. ^.^;
There is one change that I would make though, I’d add a new action:
socket |> post(name_binary, value_anything_serializable_by_poison, into: selector//nil)
The reason would be is to update a global table of values with the name of whatever name_binary, so doing this:
socket
|> post("theName", %{blah: 42, bloop: "Hello world"})
|> post("theName.blah", 84)
Would set a global scope javascript variable (since the selector is nil
by default) that would end up being the javascript {blah: 84, bloop: "Hello world"}
in the global variable name of theName
. If you pass in a selector then it sets those properties (not attributes, attributes you should append the name with a $
) on the html elements themselves. This would follow the current style of webcomponents and allow controlling webcomponents far more easily. In addition you could add something like:
<span drab-set-body="theName.bloop></span>
Which when combined with the above post
would make the span display “Hello World” in it.
You could even go further and do something like:
<span drab-wire style="height: [[theName.blah]]">Message: [[theName.bloop]]</span>
Where when drab-wire is truthy on an element then it is ‘processed’ template-like, which basically gives you the polymer style templates that you wire up to values that the server controls, which gives you very fine-grained control and setting of things without needing a webcomponent library like polymer (should have a meta value that defines the template parts like [[
/]]
so it could be used with something like polymer by changing it to ((
/))
or whatever the user wants per-page, or just default to ((
/))
?
It would be really cool to basically have a polymer-drab that is like polymer’s templating but controlled entirely server-side.
Really should stop using jQuery. ^.^