bitovi/canjs

View on GitHub
demos/technology-overview/my-counter.html

Summary

Maintainability
Test Coverage
<body>
<div id="demo-html">
<my-counter></my-counter>
</div>

<script src="../../node_modules/steal/steal.js" dev-bundle main="@empty" id="demo-source">
import { StacheElement } from "can";

class MyCounter extends StacheElement {
    static view = `
                <button on:click="this.increment()">+1</button>
                Count: <span>{{ this.count }}</span>
        `;

    static props = {
                count: 0
        };

    increment() {
                this.count++;
    }
}
customElements.define("my-counter", MyCounter);
</script>

</body>