javascript - Is there a way to listen silent events on backbonejs? -


i'm trying listen backbone's model's ´changed´-event attribute, like

this.listento(this, 'change:someattr', this.eventlistener); 

however, changed silently, normal event listening not work. there way listen backbone's silent events?

the way can think of via sort of "polling", ie checking on , on via setinterval.

initialize: function() {     this.listensilent(); }, listensilent: function() {     var startval = this.get('myattr');     var = this;     var silentlistener = setinterval(function() {         if (that.get('myattr') !== startval) {             that.trigger('myevent'); // custom event name can listen             stopinterval(silentlistener);             that.listensilent();         }     }, 100); } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -