mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
feat(plugin): add onPlayerApiReady hook
Co-authored-by: JellyBrick <shlee1503@naver.com>
This commit is contained in:
@ -85,7 +85,7 @@ export default builder.createRenderer(({ getConfig, invoke }) => {
|
||||
});
|
||||
|
||||
// Exit just before the end for the transition
|
||||
const transitionBeforeEnd = async () => {
|
||||
const transitionBeforeEnd = () => {
|
||||
if (
|
||||
video.currentTime >= video.duration - config.secondsBeforeEnd
|
||||
&& isReadyToCrossfade()
|
||||
@ -140,14 +140,11 @@ export default builder.createRenderer(({ getConfig, invoke }) => {
|
||||
};
|
||||
|
||||
return {
|
||||
onLoad() {
|
||||
document.addEventListener('apiLoaded', async () => {
|
||||
config = await getConfig();
|
||||
onApiLoaded();
|
||||
}, {
|
||||
once: true,
|
||||
passive: true,
|
||||
});
|
||||
async onLoad() {
|
||||
config = await getConfig();
|
||||
},
|
||||
onPlayerApiReady() {
|
||||
onApiLoaded();
|
||||
},
|
||||
onConfigChange(newConfig) {
|
||||
config = newConfig;
|
||||
|
||||
Reference in New Issue
Block a user