mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 18:57:01 +00:00
Bind method to 'this' so that its listeners are correctly unbound on destroy (#3948)
* Bind method to 'this' so that its listener can work correctly * Bind this for toggling subscriptions as well
This commit is contained in:
parent
6755ef4641
commit
fa5aceb7b3
@ -27,15 +27,17 @@ export default class StyleRuleManager extends EventEmitter {
|
||||
super();
|
||||
this.openmct = openmct;
|
||||
this.callback = callback;
|
||||
this.refreshData = this.refreshData.bind(this);
|
||||
this.toggleSubscription = this.toggleSubscription.bind(this);
|
||||
if (suppressSubscriptionOnEdit) {
|
||||
this.openmct.editor.on('isEditing', this.toggleSubscription.bind(this));
|
||||
this.openmct.editor.on('isEditing', this.toggleSubscription);
|
||||
this.isEditing = this.openmct.editor.editing;
|
||||
}
|
||||
|
||||
if (styleConfiguration) {
|
||||
this.initialize(styleConfiguration);
|
||||
if (styleConfiguration.conditionSetIdentifier) {
|
||||
this.openmct.time.on("bounds", this.refreshData.bind(this));
|
||||
this.openmct.time.on("bounds", this.refreshData);
|
||||
this.subscribeToConditionSet();
|
||||
} else {
|
||||
this.applyStaticStyle();
|
||||
|
Loading…
Reference in New Issue
Block a user