Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount () {
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
this.props.vm.loadProject(this.props.projectData)
.then(() => {
this.setState({loading: false}, () => {
this.props.vm.setCompatibilityMode(true);
this.props.vm.start();
});
})
.catch(e => {
// Need to catch this error and update component state so that
// error page gets rendered if project failed to load
this.setState({loadingError: true, errorMessage: e});
});
}
componentWillReceiveProps (nextProps) {
componentDidMount () {
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
this.props.vm.loadProject(this.props.projectData).then(() => {
this.setState({loading: false}, () => {
this.props.vm.setCompatibilityMode(true);
this.props.vm.start();
});
});
}
componentWillReceiveProps (nextProps) {
componentDidMount () {
if (this.props.vm.initialized) return;
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
this.props.vm.setCompatibilityMode(true);
this.props.vm.start();
this.props.vm.initialized = true;
}
componentDidUpdate (prevProps) {
componentDidMount () {
this.audioEngine = new AudioEngine();
this.playingSoundPromise = null;
}
componentWillUnmount () {