Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
608 Bytes
import * as reducerType from '../../unit/reducerType';
import { lastRecord } from '../../unit/const';
import { hasWebAudioAPI } from '../../unit/music';
let initState = lastRecord && lastRecord.music !== undefined ? !!lastRecord.music : true;
if (!hasWebAudioAPI.data) {
initState = false;
}
const music = (state = initState, action) => {
switch (action.type) {
case reducerType.MUSIC:
if (!hasWebAudioAPI.data) { // 若浏览器不支持 WebAudioApi, 将无法播放音效
return false;
}
return action.data;
default:
return state;
}
};
export default music;