Refactor
This commit is contained in:
@@ -53,7 +53,12 @@ export class Tree<ViewModel> extends TreeNode<ViewModel> {
|
||||
super(undefined, undefined)
|
||||
}
|
||||
|
||||
public updateWithConnection(emitter: EventBusInterface, connectionId: string, nodeFilter?:(node: TreeNode<ViewModel>) => boolean) {
|
||||
private handleNewData = (msg: MqttMessage) => {
|
||||
this.unmergedMessages.push(msg)
|
||||
this.didReceive.dispatch()
|
||||
}
|
||||
|
||||
public updateWithConnection(emitter: EventBusInterface, connectionId: string, nodeFilter?: (node: TreeNode<ViewModel>) => boolean) {
|
||||
this.updateSource = emitter
|
||||
this.connectionId = connectionId
|
||||
this.nodeFilter = nodeFilter
|
||||
@@ -82,11 +87,6 @@ export class Tree<ViewModel> extends TreeNode<ViewModel> {
|
||||
return this.unmergedMessages
|
||||
}
|
||||
|
||||
private handleNewData = (msg: MqttMessage) => {
|
||||
this.unmergedMessages.push(msg)
|
||||
this.didReceive.dispatch()
|
||||
}
|
||||
|
||||
public stopUpdating() {
|
||||
if (this.subscriptionEvent && this.updateSource) {
|
||||
this.updateSource.unsubscribe(this.subscriptionEvent, this.handleNewData)
|
||||
|
||||
Reference in New Issue
Block a user