mirror of
https://github.com/ragestudio/comty.git
synced 2025-07-09 17:24:16 +00:00
Simplify player state update logic
This commit is contained in:
parent
01608e2f1a
commit
1e6dae8204
@ -40,9 +40,7 @@ export const usePlayerStateContext = (updater) => {
|
|||||||
app.cores.player.eventBus().on("player.state.update", handleStateChange)
|
app.cores.player.eventBus().on("player.state.update", handleStateChange)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
app.cores.player
|
app.cores.player.eventBus().off("player.state.update", handleStateChange)
|
||||||
.eventBus()
|
|
||||||
.off("player.state.update", handleStateChange)
|
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -56,9 +54,7 @@ export class WithPlayerContext extends React.Component {
|
|||||||
|
|
||||||
events = {
|
events = {
|
||||||
"player.state.update": async (state) => {
|
"player.state.update": async (state) => {
|
||||||
if (state !== this.state) {
|
this.setState(state)
|
||||||
this.setState(state)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user