mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +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:
@ -27,15 +27,17 @@ export default class StyleRuleManager extends EventEmitter {
|
|||||||
super();
|
super();
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
this.refreshData = this.refreshData.bind(this);
|
||||||
|
this.toggleSubscription = this.toggleSubscription.bind(this);
|
||||||
if (suppressSubscriptionOnEdit) {
|
if (suppressSubscriptionOnEdit) {
|
||||||
this.openmct.editor.on('isEditing', this.toggleSubscription.bind(this));
|
this.openmct.editor.on('isEditing', this.toggleSubscription);
|
||||||
this.isEditing = this.openmct.editor.editing;
|
this.isEditing = this.openmct.editor.editing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styleConfiguration) {
|
if (styleConfiguration) {
|
||||||
this.initialize(styleConfiguration);
|
this.initialize(styleConfiguration);
|
||||||
if (styleConfiguration.conditionSetIdentifier) {
|
if (styleConfiguration.conditionSetIdentifier) {
|
||||||
this.openmct.time.on("bounds", this.refreshData.bind(this));
|
this.openmct.time.on("bounds", this.refreshData);
|
||||||
this.subscribeToConditionSet();
|
this.subscribeToConditionSet();
|
||||||
} else {
|
} else {
|
||||||
this.applyStaticStyle();
|
this.applyStaticStyle();
|
||||||
|
Reference in New Issue
Block a user