JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/riot/2.0.15/riot.min.js"></script>
<counter></counter>
JavaScript
(function (console) { "use strict";
var riot_IRiotComponent = function() { };
var Component = function(v,opts) {
this.view = v;
this.view.incr = $bind(this,this.incr);
this.view.counter = 0;
};
Component.__interfaces__ = [riot_IRiotComponent];
Component.prototype = {
incr: function() {
this.view.counter++;
}
,bind_view: function(v) {
this.view = v;
this.view.incr = $bind(this,this.incr);
}
};
var Test = function() { };
Test.main = function() {
};
var $_, $fid = 0;
function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; }
var tagName = 'counter';
if(tagName != "") {
var template = "<button onclick={incr}>incr</button>\n<span class=\"counter\">{counter}</span>\n";
var style;
var _this = window.document;
style = _this.createElement("style");
style.innerHTML = ".counter {\n background:red;\n color:yellow;\n}\n";
window.document.head.appendChild(style);
riot.tag(tagName,template,function(opts) {
var cls = Component;
var self = this;
var instance = new cls(self,opts);
});
riot.mount("*");
}
Test.main();
})(typeof console != "undefined" ? console : {log:function(){}});