stukjs
v0.1.3
Published
two way data bind for vanilla js/html
Downloads
2
Maintainers
Readme
stukJs- Simplified two-way data bind for JS
Installation
npm:
$ npm i stukjs --save
browser:
<script src="https://unpkg.com/stukjs@latest/Stuk.js"></script>
Usage
Pass an object containing all the variables that will be used by the page to stuk.bindpage()
, and then add the stuk
attribute to elements that should bind to a variable. The value passed to the stuk
attribute should be an existing key in the object passed to stuk.bindpage()
.
Changes to the bound variable's value will be reflected in the page, and changes made to the bound element's value will also propagate back to the script.
Example
<input stuk="name">
<script>
Stuk.bindPage({name:"Benedetti"});
</script>
Notes
this code was based on: wintellect.