-
-
Save webOS101/806bfb70741a304822b6 to your computer and use it in GitHub Desktop.
RestaurantModel with Change Handler
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
<div id="jsconsole"> | |
<form> | |
<textarea autofocus id="exec" spellcheck="false" autocapitalize="off" autofocus rows="1"> </textarea> | |
</form> | |
<div id="console"> | |
<ul id="output"></ul> | |
</div> | |
</div> | |
<div id="footer"><a href="http://github.com/remy/jsconsole">Fork on Github</a> • <a href="http://twitter.com/rem">Console built by @rem</a></div><script src="http://enyo-upandrunning.github.io/prettify.js"></script> | |
<script> | |
window.JSCONSOLE = { | |
contentWindow: this, | |
contentDocument: document, | |
console: document.getElementById('jsconsole') | |
}; | |
</script> | |
<script src="http://enyo-upandrunning.github.io/console.js"></script> | |
<script> | |
_console.post("var rest = new RestaurantModel({name: 'Izakaya Seki'});\n\nrest.changeCount;"); | |
_console.post("rest.set('name','Inn at Little Washington');\n\nrest.changeCount;") | |
</script> |
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.kind({ | |
name: 'RestaurantModel', | |
kind: 'enyo.Model', | |
attributes: { | |
name: 'unknown', | |
cuisine: 'unknown', | |
specialty: 'unknown', | |
rating: 0 | |
}, | |
nameChanged: function(was, is) { | |
if(is) { | |
this.changeCount = this.changeCount ? | |
this.changeCount++ : 1; | |
} | |
} | |
}); |
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: RestaurantModel with Change Handler | |
description: Derive a model kind from the default Enyo model and see it in action | |
authors: | |
- Roy Sutton | |
resources: | |
- http://enyo-upandrunning.github.io/console.css | |
normalize_css: no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment