refactor: optimize component lifecycle and build process

- React: Removed unnecessary dependencies from useEffect in Artplayer component.
- Vue: Simplified instance emission in Artplayer component by removing nextTick.
- Build script: Added cpy to copy built i18n files to a new directory and set context to browser for Parcel.
This commit is contained in:
Harvey Zack committed 2025-08-17 17:25:16 +08:00
1 parent 0eed9c114b
commit 5cc6724f54
17 files changed
+25 -19

No files matched your search

@@ -31,7 +31,7 @@ export default function Player({ option, getInstance, ...rest }) {
}
return () => art.destroy(false)
}, [option, getInstance])
}, [])
return <div ref={$container} {...rest}></div>
}
@@ -5,7 +5,7 @@ import Artplayer from 'artplayer'
import fr from 'artplayer/i18n/fr'
import id from 'artplayer/i18n/id'
import { nextTick, onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
// test plugins
import artplayerPluginDanmuku from '../../../artplayer-plugin-danmuku'
@@ -36,9 +36,7 @@ onMounted(() => {
}),
],
})
nextTick(() => {
emit('getInstance', art.value)
})
emit('getInstance', art.value)
})
onBeforeUnmount(() => {