1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00
mpd-client/assets/js/components/app.js
Dan Barber cc3a6217da Partway through component refactor.
* Queue now displays.
* Does not yet update.
2013-12-20 15:29:39 +00:00

31 lines
563 B
JavaScript

can.Component.extend({
tag: 'mpd-client',
template: can.view('views/app.mustache'),
scope: {
queueSongs: new can.List(),
status: new can.Map()
},
events: {
init: function(element, options) {
this.scope.attr('events', new Events(this.scope.queueSongs, this.scope.status));
this.fetch();
},
fetch: function() {
var self = this;
QueueSong.findAll().then(function(songs) {
self.update(songs);
});
},
update: function(songs) {
this.scope.attr('queueSongs', songs);
}
}
});