JSFiddle - React, Tailwind, and code Playground
by enyojs
JavaScript
enyo.kind({
name: "MySample",
components: [
{kind: "onyx.Toolbar", content: "Your sample here"}
],
bindings: [
{from: ".model.foo", to:".$.toolbar.content"}
],
create: function() {
this.inherited(arguments);
this.set("model", new MyModel());
this.startJob("fetch", function() {
this.model.fetch();
}, 1000);
}
});
enyo.kind({
name: "MyModel",
kind: "enyo.Model",
defaultSource: "mysource",
attributes: {
foo: function() {
return this.get("a") + " and " + this.get("b");
}
},
computed: {
foo: ["a","b"]
},
parse: function(data) {
var d = {a: data.bogus.a, b: data.bogus.b};
return d;
}
});
enyo.kind({
name: "foo.MySource",
kind: "enyo.Source",
fetch: function(rec, opts) {
opts.success({bogus: {
a: "funday",
b: "sunday"
}});
}
});
enyo.store.addSources({mysource: "foo.MySource"});
new MySample({fit:true}).write();