can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
26 lines (19 loc) • 552 B
HTML
<script src="../../node_modules/steal/steal.js" dev-bundle main='@empty'>
import { DefineMap, can, stache, stacheBindings } from "can";
window.can = can;
var CounterVM = DefineMap.extend("CounterVM",{
count: {default: 0, type: "number"},
add: function(){
this.count++;
}
});
var tempate = stache(`
<span>{{ count }}</span>
<button on:click="add()">+1</button>
`);
var instance = new CounterVM();
document.body.appendChild(tempate(instance));
instance.on("count", function instanceCountChanged(){
debugger;
});
</script>