mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
fix: 🚑 fix stream.ts
This commit is contained in:
parent
eeb97d0645
commit
0ba61b5cd9
1 changed files with 11 additions and 19 deletions
|
@ -3,26 +3,18 @@ import { markRaw } from "vue";
|
|||
import { $i } from "@/account";
|
||||
import { url } from "@/config";
|
||||
|
||||
let stream: Misskey.Stream | null = null;
|
||||
|
||||
export function useStream(): Misskey.Stream {
|
||||
if (stream) return stream;
|
||||
|
||||
stream = markRaw(
|
||||
export const stream = markRaw(
|
||||
new Misskey.Stream(
|
||||
url,
|
||||
$i
|
||||
? {
|
||||
token: $i.token,
|
||||
}
|
||||
: null
|
||||
)
|
||||
);
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
||||
window.setTimeout(heartbeat, 1000 * 60);
|
||||
|
||||
return stream;
|
||||
}
|
||||
window.setTimeout(heartbeat, 1000 * 60);
|
||||
|
||||
function heartbeat(): void {
|
||||
if (stream != null && document.visibilityState === "visible") {
|
||||
|
|
Loading…
Reference in a new issue