Street testing fixes

This commit is contained in:
Robin Davies
2021-12-31 10:30:31 -05:00
parent d717a742b9
commit 96584fd4a7
17 changed files with 868 additions and 116 deletions
+11 -1
View File
@@ -19,7 +19,7 @@
import React, { Component } from 'react';
import { createStyles, withStyles, WithStyles, Theme } from '@material-ui/core/styles';
import { PiPedalModel, PiPedalModelFactory, VuUpdateInfo, VuSubscriptionHandle } from './PiPedalModel';
import { PiPedalModel, State,PiPedalModelFactory, VuUpdateInfo, VuSubscriptionHandle } from './PiPedalModel';
const DISPLAY_HEIGHT = 110;
@@ -226,6 +226,7 @@ export const VuMeter =
this.yYellow = dbToY(DB_YELLOW);
this.onVuChanged = this.onVuChanged.bind(this);
this.onStateChanged = this.onStateChanged.bind(this);
}
@@ -401,13 +402,22 @@ export const VuMeter =
}
}
onStateChanged(state: State) {
// initial connection or reconnect
if (state === State.Ready)
{
this.addVuSubscription(); // re-subscribe.
}
}
componentDidMount() {
this.model.state.addOnChangedHandler(this.onStateChanged);
this.addVuSubscription();
}
componentWillUnmount() {
this.removeVuSubscription();
this.model.state.removeOnChangedHandler(this.onStateChanged);
}
}
);