-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New plugin: Taskbar Progress #4057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@ArjixWasTaken can you review? |
| if ( | ||
| !songInfo?.title || | ||
| typeof songInfo.elapsedSeconds !== 'number' || | ||
| !songInfo.songDuration | ||
| ) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be better to use zod here
| progressInterval = setInterval(() => { | ||
| if ( | ||
| lastSongInfo && | ||
| !lastSongInfo.isPaused && | ||
| typeof lastSongInfo.elapsedSeconds === 'number' | ||
| ) { | ||
| updateProgressBar({ | ||
| ...lastSongInfo, | ||
| elapsedSeconds: lastSongInfo.elapsedSeconds + 1, | ||
| }); | ||
| } | ||
| }, 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an interval is not guaranteed to run on a precise manner, could you maybe refactor this to not depend on the interval, and maybe calculate the elapsedSeconds using an external variable?
e.g.
const intervalStart = performance.now();
setInterval(() => {
const elapsedSeconds = (performance.now() - intervalStart) / 1000;
// ...
}, 1000)| export default createPlugin({ | ||
| name: () => t('plugins.taskbar-progress.name'), | ||
| description: () => t('plugins.taskbar-progress.description'), | ||
| restartNeeded: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please properly implement the cleanup logic required to turn this into restartNeeded: false, you just need to cleanup some intervals
you cannot unregister the song info callback, but you can remove all side-effects when the plugin is disabled
It shows track playing progress in taskbar:


On pause:
Resolves #2416