diff options
| author | stonedDiscord <stonedDiscord@users.noreply.github.com> | 2024-11-20 13:31:50 +0000 |
|---|---|---|
| committer | GitHub Action <actions@github.com> | 2024-11-20 13:31:50 +0000 |
| commit | 6684f3fce6e90fd0574d7bab63b629554ab03ef6 (patch) | |
| tree | b2a62247d17e23a77af57aea355ba621666817c2 /webAO/packets/handlers/handleRMC.ts | |
| parent | 95a2d1361d84c61b454ebe506e6963b93f6d8dee (diff) | |
Prettified Code!
Diffstat (limited to 'webAO/packets/handlers/handleRMC.ts')
| -rw-r--r-- | webAO/packets/handlers/handleRMC.ts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/webAO/packets/handlers/handleRMC.ts b/webAO/packets/handlers/handleRMC.ts index ada1ad2..7758844 100644 --- a/webAO/packets/handlers/handleRMC.ts +++ b/webAO/packets/handlers/handleRMC.ts @@ -1,4 +1,4 @@ -import { client } from '../../client' +import { client } from "../../client"; // TODO BUG: // this.viewport.music is an array. Therefore you must access elements /** @@ -6,19 +6,19 @@ import { client } from '../../client' * @param {Array} args packet arguments */ export const handleRMC = (args: string[]) => { - client.viewport.music.pause(); - const { music } = client.viewport; - // Music offset + drift from song loading - music.totime = args[1]; - music.offset = new Date().getTime() / 1000; - music.addEventListener( - "loadedmetadata", - () => { - music.currentTime += parseFloat( - music.totime + (new Date().getTime() / 1000 - music.offset) - ).toFixed(3); - music.play(); - }, - false - ); -}
\ No newline at end of file + client.viewport.music.pause(); + const { music } = client.viewport; + // Music offset + drift from song loading + music.totime = args[1]; + music.offset = new Date().getTime() / 1000; + music.addEventListener( + "loadedmetadata", + () => { + music.currentTime += parseFloat( + music.totime + (new Date().getTime() / 1000 - music.offset), + ).toFixed(3); + music.play(); + }, + false, + ); +}; |
