Better client unmounting in simulator.
This commit is contained in:
parent
a28938aaa2
commit
034aac99d9
2 changed files with 7 additions and 3 deletions
|
@ -61,6 +61,7 @@ function getProps (render) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let client = {
|
let client = {
|
||||||
|
_backend: backend,
|
||||||
sources: [],
|
sources: [],
|
||||||
realPosition: 0,
|
realPosition: 0,
|
||||||
clientId: 0,
|
clientId: 0,
|
||||||
|
@ -76,9 +77,6 @@ function getProps (render) {
|
||||||
client.name = name;
|
client.name = name;
|
||||||
render();
|
render();
|
||||||
},
|
},
|
||||||
onComponentUnmount: () => {
|
|
||||||
backend.close();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StartAudioContext(backend._context, '.playit')
|
StartAudioContext(backend._context, '.playit')
|
||||||
|
@ -123,6 +121,9 @@ function getProps (render) {
|
||||||
render();
|
render();
|
||||||
},
|
},
|
||||||
onSubmitPassword: (password) => doHello(password),
|
onSubmitPassword: (password) => doHello(password),
|
||||||
|
onComponentUnmount: () => {
|
||||||
|
clients.forEach(x => x._backend.close());
|
||||||
|
},
|
||||||
onChangePassword: (password) => {
|
onChangePassword: (password) => {
|
||||||
simulator.password = password;
|
simulator.password = password;
|
||||||
render();
|
render();
|
||||||
|
|
|
@ -9,6 +9,9 @@ class Simulator extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.props.onComponentUnmount && this.props.onComponentUnmount();
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue