Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init = async () => {
const state = await this.getStorage(undefined, this.namespace)
this.setState({
...state,
visible: false,
chap: '',
vol: '',
_loaded: true
})
const res = subjectStore.fetchSubject(this.subjectId)
const data = await res
const item = bangumiData.items.find(item => item.title === data.name)
if (item) {
this.setState({
bangumiInfo: {
sites: item.sites,
type: item.type
}
})
}
// 获取其他源头eps在线地址
if (this.type === '动画') {
const { _ningMoeId } = this.params
if (_ningMoeId) {
discoveryStore.fetchNingMoeDetail({
id: _ningMoeId,
bgmId: this.subjectId
export function findBangumiCn(jp = '') {
if (_bangumiFindHistory[jp]) {
return _bangumiFindHistory[jp]
}
const item = bangumiData.items.find(item => item.title === jp)
if (item) {
const cn =
(item.titleTranslate &&
item.titleTranslate['zh-Hans'] &&
item.titleTranslate['zh-Hans'][0]) ||
jp
_bangumiFindHistory[jp] = cn
return cn
}
_bangumiFindHistory[jp] = jp
return jp
}