JSFiddle - React, Tailwind, and code Playground
by rich_harris
HTML
<main>foo</main>
JavaScript
function ractiveExtendTypeScriptClass(tsClass) {
var instance = new tsClass();
var options = {};
for (var key in instance) {
options[key] = instance[key];
}
console.log( 'options', options );
console.log( '^ the options object passed to Ractive.extend() has a constructor property, which causes everything to get confused' );
delete options.constructor;
return Ractive.extend(options);
}
function __extends (target, source) {
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
target[prop] = source[prop];
}
}
function __() { this.constructor = target; }
__.prototype = source.prototype;
target.prototype = new __();
}
function Block() {}
function ChooseTemplate() {}
__extends(ChooseTemplate, Block);
var RChooseTemplate = ractiveExtendTypeScriptClass(ChooseTemplate);
var tplMenu = new RChooseTemplate({
el: 'body',
template: '<h1>Hello</h1>',
});