mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-09 08:03:24 +00:00
Révise la récupération des données avec une Radio
This commit is contained in:
25
js/app/radios/sounds.js
Normal file
25
js/app/radios/sounds.js
Normal file
@@ -0,0 +1,25 @@
|
||||
define(
|
||||
'radios/sounds',
|
||||
[
|
||||
'marionette',
|
||||
'backbone.radio',
|
||||
'collections/sounds'
|
||||
],
|
||||
function (Marionette, Radio, SoundsCollection) {
|
||||
"use strict";
|
||||
|
||||
var SoundsRadio = Marionette.Object.extend({
|
||||
initialize : function () {
|
||||
this.channel = Radio.channel('Sounds');
|
||||
|
||||
this.channel.reply('getSounds', this.getSounds.bind(this));
|
||||
},
|
||||
getSounds: function() {
|
||||
var soundsCollection = new SoundsCollection();
|
||||
|
||||
return soundsCollection.fetch();
|
||||
}
|
||||
});
|
||||
|
||||
return SoundsRadio;
|
||||
});
|
||||
Reference in New Issue
Block a user