Skip to content

Instantly share code, notes, and snippets.

View webOS101's full-sized avatar

Roy Sutton webOS101

  • LG Silicon Valley Lab
View GitHub Profile
@webOS101
webOS101 / fiddle.js
Created September 11, 2014 17:19
Control Sample
enyo.ready(function() {
enyo.kind({
name: 'ControlSample',
components: [
{ kind: 'Button', content: 'Click', ontap: 'tapped' },
{ tag: 'br'},
{ kind: 'Checkbox', checked: true, onchange: 'changed' },
{ tag: 'br'},
{ kind: 'Input', placeholder: 'Enter something', onchange: 'changed' },
{ tag: 'br'},
@webOS101
webOS101 / fiddle.js
Created September 11, 2014 17:02
Dynamic Components
enyo.ready(function() {
enyo.kind({
name: 'DynamicSample',
components: [
{ kind: 'Button', content: 'Click', ontap: 'tapped' }
],
tapped: function(inSender, inEvent) {
this.createComponent({ content: 'A new component' });
this.render();
return true;
@webOS101
webOS101 / fiddle.js
Created September 11, 2014 16:48
Create and Destroy
enyo.ready(function() {
enyo.kind({
name: 'Heartbeat',
events: {
onBeat: ''
},
create: function() {
this.inherited(arguments);
this.timer = window.setInterval(enyo.bind(this, 'beat'), 1000);
},
@webOS101
webOS101 / fiddle.js
Created September 10, 2014 22:02
Instance Counter
enyo.ready(function() {
enyo.kind({
name: 'InstanceCounter',
constructor: function() {
InstanceCounter.count += 1;
this.inherited(arguments);
},
statics: {
count: 0,
currentCount: function() {
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
Signal Sample
enyo.ready(function() {
enyo.kind({
name: 'Signaller',
components: [
{ kind: 'Button', content: 'Click', ontap: 'sendit' }
],
sendit: function() {
enyo.Signals.send('onButtonSignal');
}
});
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
Event Sample
enyo.ready(function() {
enyo.kind({
name: 'Eventer',
handlers: { ontap: 'myTap' },
events: { onMyEvent: '' },
content: 'Click for the answer',
myTap: function() {
this.doMyEvent({ answer: 42 });
}
});
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
Powered Light with Event and Logging
enyo.ready(function() {
enyo.kind({
name: 'Light',
color: 'yellow',
style: 'width: 50px; height: 50px; border-radius: 50%;',
create: function() {
this.inherited(arguments);
this.colorChanged();
},
colorChanged: function(oldValue) {
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
Powered Light
enyo.ready(function() {
enyo.kind({
name: 'Light',
color: 'yellow',
style: 'width: 50px; height: 50px; border-radius: 50%;',
create: function() {
this.inherited(arguments);
this.colorChanged();
},
colorChanged: function(oldValue) {
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
First Traffic Light
enyo.ready(function() {
enyo.kind({
name: 'Light',
color: 'yellow',
style: 'width: 50px; height: 50px; border-radius: 50%;',
create: function() {
this.inherited(arguments);
this.colorChanged();
},
colorChanged: function(oldValue) {
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
Dynamic Light
enyo.ready(function() {
enyo.kind({
name: 'Light',
color: 'yellow',
style: 'width: 50px; height: 50px; border-radius: 50%;',
create: function() {
this.inherited(arguments);
this.colorChanged();
},
colorChanged: function(oldValue) {