factorapp / factor

Component based full stack web framework using Web Assembly for Go
https://factorapp.io
Apache License 2.0
60 stars 5 forks source link

idea: {vector-rpc} replacement tag for events? #19

Open arschles opened 6 years ago

arschles commented 6 years ago

right now, if you want to do RPC in vecty, you have to:

  1. call an event handler in your template
  2. make the event handler call and RPC endpoint
  3. get data back
  4. re-render the template with the data

it would be nice if you could put a {vecty-rpc: MyRPCMethod} into your template like this:

<a onclick="{vecty-rpc:MyRPCMethod}" data-target="someid">Click Here!</a>
<div id="someid">Here's where the RPC return data goes</div>

And have factor generate code or dynamically call the RPC method when the click event happens. Then, when the RPC data comes back, it would populate the <div id="someid"> tag with the return data.

arschles commented 6 years ago

Related to #20

bketelsen commented 6 years ago

Super DOPE!