Last active
August 29, 2015 14:06
-
-
Save webOS101/170bc8cce1936aeecf32 to your computer and use it in GitHub Desktop.
Dynamic Light
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
this.applyStyle('background-color', this.color); | |
} | |
}); | |
var app = new enyo.Application({ name: 'app', view: Light }); | |
app.set('view.color', 'blue'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dynamic Light | |
description: Example showing how to update color of a Light instance after it's created | |
authors: | |
- Roy Sutton | |
normalize_css: no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try it out on jsFiddle
From: Enyo: Up and Running by Roy Sutton