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
Last active August 29, 2015 14:06
Enyo Data Source Sample
enyo.ready(function() {
enyo.AjaxSource.create({ name: 'ajax' });
var collection = new enyo.Collection({
source: 'ajax',
url: 'https://api.github.com/users/enyojs/repos'
});
enyo.kind({
name: 'RepoView',
kind: 'DataRepeater',
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
First Light
enyo.ready(function() {
enyo.kind({
name: 'Light',
style: 'width: 50px; height: 50px; border-radius: 50%;' +
'background: yellow;'
});
new enyo.Application({name: 'app', view: 'Light'});
});
@webOS101
webOS101 / fiddle.js
Last active August 29, 2015 14:06
Improved 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) {
@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
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
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
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
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
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() {