Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Volume as VolumeType,
Action
} from '../server/Models'
import Playback from './Playback'
import Volume from './Volume'
// TODO: refactor into an union type
interface AppState {
connected: boolean
currentTrack: Option
volume: VolumeType
}
const initialState: AppState = {
connected: false,
currentTrack: Option.none(),
volume: {
type: 'audible',
volume: 0
}
}
export default class App extends Component<{}, AppState> {
socket = io('/', {
autoConnect: false
})
state = initialState
componentDidMount() {
this.socket.on('message', (message: Message) => {
switch (message.type) {
case 'playback':
l => {
const messageResult = parseMessage(l)
return messageResult.success
? Option.of(messageResult.value)
: Option.none()
}
)