I am trying to create a static property in an ember object (all instances should have the same property and respond when it changes). In my case, I have 4 different instances, if any of these instances changes the property refresh, I want all 4 instances to respond to it.
I found that binding refreshis only done for the current instance in which I want it to be done for the whole instance if it is a static property.
enabled : function() {
...
}.property('refresh'), <----- this only executes for the current instance
selectionChanged : function() {
...
this.incrementProperty('refresh');
}.observes('selection')
I tried to create a property refreshusing mixin
var AbstractControlMixin = Ember.Mixin.create({
refresh : 0
});
var AbstractControl = Ember.Object.extend(AbstractControlMixin,{
...
});
using the re-open method
var AbstractControl = Ember.Object.extend({
...
});
AbstractControl.reopen({
refresh : 0
});
but does not work.
source
share