JSFiddle - React, Tailwind, and code Playground

by enyojs

JavaScript

enyo.kind({
    name: "MySample",
    str: "The number is ",
    val: 1,
    bindings: [
        {from: ".computedVal", to:".$.toolbar.content" }
    ],
    computed: {
        computedVal: ["str", "val"]
    },
    components: [
        {kind: "onyx.Toolbar", content: "Your sample here"},
        {kind: "onyx.Button", content: "Increment", ontap:"increment"},
        {kind: "onyx.Button", content: "Change String", ontap:"changeStr"}
    ],
    increment: function() {
        this.set("val", this.val + 1);
    },
    changeStr: function() {
        this.set("str", this.str == "Foo " ? "The number is " : "Foo ");
    },
    computedVal: function() {
        return this.get("str") + this.get("val");
    }
});

new MySample({fit:true}).write();