My web app is built using Ember.JS and Firebase for storing data. It also serves as a backend for a mobile app. Users can use mobile app to send a 'help-request' - the app manipulates directly with the Firebase records. When the change is made admin of the web app can see the notification on the screen. That works fine. Now I want to add a sound to this notification.
My general idea to solve it to add an observer that will be triggered when a new record of help-request type is added to the database.
I found a post sort of explaining how to do it but it's using deprecated methods like ArrayControler.
I added a simple observer to help-request model that is triggered when property/ies of the record are modified. That works fine but seems to be a hack rather than a real solution.
So the big question is: 1. Is there any callback, or event, or notification that I can subscribe to check if a new record is created in the Firebase? If so how would I subscribe to it?
import DS from 'ember-data';
export default DS.Model.extend({
device: DS.attr('string'),
userName: DS.attr('string'),
locationName: DS.attr('string'),
type: DS.attr('string'),
fullNameChanged: function() {
// deal with the change
console.log("FULL NAME");
}.observes('device').on('init')
});
Aucun commentaire:
Enregistrer un commentaire