Last active
August 29, 2015 14:06
-
-
Save webOS101/73e14b8ff016eeef87f5 to your computer and use it in GitHub Desktop.
RestaurantView
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: 'RestaurantView', | |
components: [ | |
{ name: 'name' }, | |
{ name: 'cuisine' }, | |
{ name: 'specialty' }, | |
{ name: 'rating' } | |
], | |
bindings: [ | |
{ from: 'model.name', to: '$.name.content' }, | |
{ from: 'model.cuisine', to: '$.cuisine.content' }, | |
{ from: 'model.specialty', to: '$.specialty.content' }, | |
{ from: 'model.rating', to: '$.rating.content' } | |
] | |
}); | |
enyo.kind({ | |
name: 'RestaurantModel', | |
kind: 'enyo.Model', | |
attributes: { | |
name: 'unknown', | |
cuisine: 'unknown', | |
specialty: 'unknown', | |
rating: 0 | |
} | |
}); | |
enyo.kind({ | |
name: 'MainView', | |
components: [{ name: 'restaurant', kind: 'RestaurantView' }], | |
bindings: [ | |
{ from: 'model', to: '$.restaurant.model' } | |
], | |
create: function() { | |
this.inherited(arguments); | |
this.set('model', new RestaurantModel({ | |
name: 'Orenchi', | |
cuisine: 'Japanese', | |
specialty: 'ramen' | |
})); | |
} | |
}); | |
new enyo.Application({ name: 'app', view: 'MainView' }); | |
}); |
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: RestaurantView | |
description: A kind to display the RestaurantModel | |
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