1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00
mpd-client/assets/js/controls/transport.js
2013-12-05 07:24:16 +00:00

29 lines
587 B
JavaScript

var Transport = can.Control.extend({
init: function(element, options) {
this.status = options.status;
element.html(can.view('views/transport.ejs'));
},
updateStatus: function(status) {
this.status.attr(status);
},
sendCommand: function(command) {
var self = this;
can.ajax({
url: '/api/control/' + command,
type: 'PUT',
success: function(status) {
self.updateStatus(status);
}
});
},
'button click': function(element, event) {
var command = $(element).data('command');
this.sendCommand(command);
}
});