@vkontakte/videoplayer-shared 1.0.99 → 1.0.100-dev.167890e34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ import type { Milliseconds } from "../semanticTypes";
2
+ export type TimerId = number;
3
+ export declare enum TimerModule {
4
+ SHARED = "shared",
5
+ CORE = "core",
6
+ STATISTICS = "statistics",
7
+ INTERACTIVE = "interactive",
8
+ UI = "ui",
9
+ UI_TV = "ui-tv"
10
+ }
11
+ export declare enum WorkerState {
12
+ IDLE = "idle",
13
+ STARTING = "starting",
14
+ READY = "ready",
15
+ FAILED = "failed"
16
+ }
17
+ export interface ITimers {
18
+ setTimeout: (callback: VoidFunction, delay?: Milliseconds) => TimerId;
19
+ clearTimeout: (id?: TimerId) => void;
20
+ setInterval: (callback: VoidFunction, delay?: Milliseconds) => TimerId;
21
+ clearInterval: (id?: TimerId) => void;
22
+ }
23
+ export type TimersDiagnostics = {
24
+ workerModules: TimerModule[];
25
+ workerState: WorkerState;
26
+ liveConsumers: number;
27
+ activeWindowTimers: number;
28
+ activeWorkerTimers: number;
29
+ workerTicks: number;
30
+ };
@@ -0,0 +1,28 @@
1
+ import type { TimerId } from "./types";
2
+ export declare enum TimerWorkerCommandName {
3
+ PING = "ping",
4
+ SET = "set",
5
+ CLEAR = "clear"
6
+ }
7
+ export declare enum TimerWorkerMessageName {
8
+ READY = "ready",
9
+ TICK = "tick"
10
+ }
11
+ export type TimerWorkerCommand = {
12
+ type: TimerWorkerCommandName.PING;
13
+ } | {
14
+ type: TimerWorkerCommandName.SET;
15
+ id: TimerId;
16
+ delay: number;
17
+ repeat: boolean;
18
+ } | {
19
+ type: TimerWorkerCommandName.CLEAR;
20
+ id: TimerId;
21
+ };
22
+ export type TimerWorkerMessage = {
23
+ type: TimerWorkerMessageName.READY;
24
+ } | {
25
+ type: TimerWorkerMessageName.TICK;
26
+ id: TimerId;
27
+ };
28
+ export declare function timerWorker(): void;