JSFiddle - React, Tailwind, and code Playground

by amspianist

JavaScript

function MyViewModel(myModel){
        this.myProperty = ko.observable('someValue');
        this.runCode = ko.computed(function (val) {
            // do some stuff any time this.myProperty() is changed
            console.log(this.myProperty());
        }, this, {deferEvaluation: true});
    }

var vm = new MyViewModel();

ko.applyBindings(vm);

vm.runCode();

vm.myProperty('some new value2');