@aifivem/lib 0.6.0 → 0.8.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.
- package/package.json +3 -3
- package/src/client/action.ts +38 -38
- package/src/client/callback.ts +70 -70
- package/src/client/controls.ts +73 -73
- package/src/client/entity.ts +15 -15
- package/src/client/headshot.ts +26 -26
- package/src/client/index.ts +2 -5
- package/src/client/localPed.ts +169 -169
- package/src/client/location.ts +54 -54
- package/src/client/netEvent.ts +40 -40
- package/src/client/nuiScreen.ts +87 -87
- package/src/client/phone.ts +14 -0
- package/src/client/players.ts +34 -34
- package/src/client/raycast.ts +48 -48
- package/src/client/shot.ts +29 -29
- package/src/client/vehicleProps.ts +107 -107
- package/src/fivem/callbackNames.ts +12 -12
- package/src/fivem/locale.ts +57 -57
- package/src/server/callback.ts +112 -112
- package/src/server/characters.ts +12 -3
- package/src/server/dataFile.ts +81 -81
- package/src/server/illegal.ts +26 -0
- package/src/server/index.ts +2 -0
- package/src/server/mdt.ts +13 -0
- package/src/server/netEvent.ts +58 -58
- package/src/server/phone.ts +11 -5
- package/src/server/position.ts +20 -20
- package/src/server/rateLimit.ts +53 -53
- package/src/server/stress.ts +4 -1
- package/src/server/warrants.ts +37 -0
- package/src/shared/format.ts +26 -26
- package/src/shared/grid.ts +20 -20
- package/src/shared/index.ts +151 -151
- package/src/shared/lang.ts +39 -39
- package/src/shared/read.ts +60 -60
- package/src/shared/strict.ts +70 -70
- package/src/shared/vec.ts +19 -19
- package/src/shared/vehicleProps.ts +138 -138
- package/src/shared/wait.ts +27 -27
package/src/shared/vec.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/** A point in the world. */
|
|
2
|
-
export interface Vec3 {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
z: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** Straight distance between two points, in metres. */
|
|
9
|
-
export const distance = (a: Vec3, b: Vec3): number =>
|
|
10
|
-
Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
11
|
-
|
|
1
|
+
/** A point in the world. */
|
|
2
|
+
export interface Vec3 {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Straight distance between two points, in metres. */
|
|
9
|
+
export const distance = (a: Vec3, b: Vec3): number =>
|
|
10
|
+
Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
11
|
+
|
|
12
12
|
/** Distance on the ground plane (x / y only), in metres. */
|
|
13
13
|
export const flatDistance = (
|
|
14
14
|
a: Pick<Vec3, "x" | "y">,
|
|
15
15
|
b: Pick<Vec3, "x" | "y">,
|
|
16
16
|
): number => Math.hypot(a.x - b.x, a.y - b.y);
|
|
17
17
|
|
|
18
|
-
/** The heading (0-360, GTA's: 0 = north, counter-clockwise) that faces from `from` towards `to`. */
|
|
19
|
-
export function headingTo(
|
|
20
|
-
from: Pick<Vec3, "x" | "y">,
|
|
21
|
-
to: Pick<Vec3, "x" | "y">,
|
|
22
|
-
): number {
|
|
23
|
-
const deg = (Math.atan2(to.x - from.x, to.y - from.y) * 180) / Math.PI;
|
|
24
|
-
return (-deg + 360) % 360;
|
|
25
|
-
}
|
|
18
|
+
/** The heading (0-360, GTA's: 0 = north, counter-clockwise) that faces from `from` towards `to`. */
|
|
19
|
+
export function headingTo(
|
|
20
|
+
from: Pick<Vec3, "x" | "y">,
|
|
21
|
+
to: Pick<Vec3, "x" | "y">,
|
|
22
|
+
): number {
|
|
23
|
+
const deg = (Math.atan2(to.x - from.x, to.y - from.y) * 180) / Math.PI;
|
|
24
|
+
return (-deg + 360) % 360;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
/** The item nearest to `point` (3D, `pos` reads an item's position), within `max` metres; undefined when none. */
|
|
28
28
|
export function nearestOf<T>(
|
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A vehicle's look and tuning as plain data (colours, mods, extras, livery, wheels, neon, tint, plate), read from and
|
|
3
|
-
* written to an entity. Stored JSON carries `v: 1`.
|
|
4
|
-
*/
|
|
5
|
-
export interface VehicleProps {
|
|
6
|
-
v: 1;
|
|
7
|
-
model: number;
|
|
8
|
-
plate: string;
|
|
9
|
-
plateIndex: number;
|
|
10
|
-
colors: [number, number];
|
|
11
|
-
extraColors: [number, number];
|
|
12
|
-
customPrimary: [number, number, number] | null;
|
|
13
|
-
customSecondary: [number, number, number] | null;
|
|
14
|
-
wheelType: number;
|
|
15
|
-
windowTint: number;
|
|
16
|
-
livery: number;
|
|
17
|
-
/** Mod type -> index (-1 = stock); toggle mods (turbo 18, xenon 22, ...) as 0 / 1. */
|
|
18
|
-
mods: Record<number, number>;
|
|
19
|
-
xenonColor: number;
|
|
20
|
-
neon: [boolean, boolean, boolean, boolean];
|
|
21
|
-
neonColor: [number, number, number];
|
|
22
|
-
tyreSmoke: [number, number, number];
|
|
23
|
-
extras: Record<number, boolean>;
|
|
24
|
-
dirt: number;
|
|
25
|
-
engineHealth: number;
|
|
26
|
-
bodyHealth: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const isObj = (v: unknown): v is Record<string, unknown> =>
|
|
30
|
-
typeof v === "object" && v !== null && !Array.isArray(v);
|
|
31
|
-
const nums = (v: unknown, n: number): number[] | null =>
|
|
32
|
-
Array.isArray(v) && v.length === n && v.every((x) => typeof x === "number")
|
|
33
|
-
? v
|
|
34
|
-
: null;
|
|
35
|
-
|
|
36
|
-
/** Stored or received props, checked; null when the shape is not ours. */
|
|
37
|
-
export function toVehicleProps(v: unknown): VehicleProps | null {
|
|
38
|
-
if (
|
|
39
|
-
!isObj(v) ||
|
|
40
|
-
v.v !== 1 ||
|
|
41
|
-
typeof v.model !== "number" ||
|
|
42
|
-
typeof v.plate !== "string"
|
|
43
|
-
)
|
|
44
|
-
return null;
|
|
45
|
-
const colors = nums(v.colors, 2);
|
|
46
|
-
const extraColors = nums(v.extraColors, 2);
|
|
47
|
-
const neonColor = nums(v.neonColor, 3);
|
|
48
|
-
const tyreSmoke = nums(v.tyreSmoke, 3);
|
|
49
|
-
if (
|
|
50
|
-
!colors ||
|
|
51
|
-
!extraColors ||
|
|
52
|
-
!neonColor ||
|
|
53
|
-
!tyreSmoke ||
|
|
54
|
-
!isObj(v.mods) ||
|
|
55
|
-
!isObj(v.extras) ||
|
|
56
|
-
!Array.isArray(v.neon)
|
|
57
|
-
)
|
|
58
|
-
return null;
|
|
59
|
-
const mods: Record<number, number> = {};
|
|
60
|
-
for (const [k, x] of Object.entries(v.mods))
|
|
61
|
-
if (typeof x === "number") mods[Number(k)] = x;
|
|
62
|
-
const extras: Record<number, boolean> = {};
|
|
63
|
-
for (const [k, x] of Object.entries(v.extras))
|
|
64
|
-
if (typeof x === "boolean") extras[Number(k)] = x;
|
|
65
|
-
const n = (x: unknown, d: number) => (typeof x === "number" ? x : d);
|
|
66
|
-
const rgb = (x: unknown) => nums(x, 3) as [number, number, number] | null;
|
|
67
|
-
return {
|
|
68
|
-
v: 1,
|
|
69
|
-
model: v.model,
|
|
70
|
-
plate: v.plate.slice(0, 8),
|
|
71
|
-
plateIndex: n(v.plateIndex, 0),
|
|
72
|
-
colors: [colors[0] ?? 0, colors[1] ?? 0],
|
|
73
|
-
extraColors: [extraColors[0] ?? 0, extraColors[1] ?? 0],
|
|
74
|
-
customPrimary: rgb(v.customPrimary),
|
|
75
|
-
customSecondary: rgb(v.customSecondary),
|
|
76
|
-
wheelType: n(v.wheelType, 0),
|
|
77
|
-
windowTint: n(v.windowTint, -1),
|
|
78
|
-
livery: n(v.livery, -1),
|
|
79
|
-
mods,
|
|
80
|
-
xenonColor: n(v.xenonColor, 255),
|
|
81
|
-
neon: [0, 1, 2, 3].map(
|
|
82
|
-
(i) => v.neon instanceof Array && v.neon[i] === true,
|
|
83
|
-
) as VehicleProps["neon"],
|
|
84
|
-
neonColor: [neonColor[0] ?? 255, neonColor[1] ?? 0, neonColor[2] ?? 255],
|
|
85
|
-
tyreSmoke: [tyreSmoke[0] ?? 255, tyreSmoke[1] ?? 255, tyreSmoke[2] ?? 255],
|
|
86
|
-
extras,
|
|
87
|
-
dirt: n(v.dirt, 0),
|
|
88
|
-
engineHealth: n(v.engineHealth, 1000),
|
|
89
|
-
bodyHealth: n(v.bodyHealth, 1000),
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** What a freshly spawned vehicle gets on top of the model's defaults (lib `spawnVehicle`'s `setup`). */
|
|
94
|
-
export interface VehicleSetup {
|
|
95
|
-
/** Every performance mod at its top level, turbo and xenons on. */
|
|
96
|
-
maxed?: boolean;
|
|
97
|
-
/** GTA colour indexes (primary, secondary), as `VehicleProps.colors`. */
|
|
98
|
-
colors?: [number, number];
|
|
99
|
-
primary?: [number, number, number];
|
|
100
|
-
secondary?: [number, number, number];
|
|
101
|
-
livery?: number;
|
|
102
|
-
windowTint?: number;
|
|
103
|
-
/** 0 (clean) - 15. */
|
|
104
|
-
dirt?: number;
|
|
105
|
-
engineOn?: boolean;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const rgbOf = (v: unknown): [number, number, number] | undefined =>
|
|
109
|
-
Array.isArray(v) &&
|
|
110
|
-
v.length === 3 &&
|
|
111
|
-
v.every((x) => typeof x === "number" && x >= 0 && x <= 255)
|
|
112
|
-
? [v[0], v[1], v[2]]
|
|
113
|
-
: undefined;
|
|
114
|
-
const intOf = (v: unknown, min: number, max: number): number | undefined =>
|
|
115
|
-
typeof v === "number" && Number.isInteger(v) && v >= min && v <= max
|
|
116
|
-
? v
|
|
117
|
-
: undefined;
|
|
118
|
-
|
|
119
|
-
const colorsOf = (v: unknown): [number, number] | undefined => {
|
|
120
|
-
if (!Array.isArray(v) || v.length !== 2) return undefined;
|
|
121
|
-
const [a, b] = [intOf(v[0], 0, 255), intOf(v[1], 0, 255)];
|
|
122
|
-
return a === undefined || b === undefined ? undefined : [a, b];
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/** A received setup, checked field by field (wrong fields drop); null when it is not an object. */
|
|
126
|
-
export function toVehicleSetup(v: unknown): VehicleSetup | null {
|
|
127
|
-
if (!isObj(v)) return null;
|
|
128
|
-
return {
|
|
129
|
-
maxed: v.maxed === true || undefined,
|
|
130
|
-
colors: colorsOf(v.colors),
|
|
131
|
-
primary: rgbOf(v.primary),
|
|
132
|
-
secondary: rgbOf(v.secondary),
|
|
133
|
-
livery: intOf(v.livery, 0, 100),
|
|
134
|
-
windowTint: intOf(v.windowTint, 0, 6),
|
|
135
|
-
dirt: intOf(v.dirt, 0, 15),
|
|
136
|
-
engineOn: v.engineOn === true || undefined,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* A vehicle's look and tuning as plain data (colours, mods, extras, livery, wheels, neon, tint, plate), read from and
|
|
3
|
+
* written to an entity. Stored JSON carries `v: 1`.
|
|
4
|
+
*/
|
|
5
|
+
export interface VehicleProps {
|
|
6
|
+
v: 1;
|
|
7
|
+
model: number;
|
|
8
|
+
plate: string;
|
|
9
|
+
plateIndex: number;
|
|
10
|
+
colors: [number, number];
|
|
11
|
+
extraColors: [number, number];
|
|
12
|
+
customPrimary: [number, number, number] | null;
|
|
13
|
+
customSecondary: [number, number, number] | null;
|
|
14
|
+
wheelType: number;
|
|
15
|
+
windowTint: number;
|
|
16
|
+
livery: number;
|
|
17
|
+
/** Mod type -> index (-1 = stock); toggle mods (turbo 18, xenon 22, ...) as 0 / 1. */
|
|
18
|
+
mods: Record<number, number>;
|
|
19
|
+
xenonColor: number;
|
|
20
|
+
neon: [boolean, boolean, boolean, boolean];
|
|
21
|
+
neonColor: [number, number, number];
|
|
22
|
+
tyreSmoke: [number, number, number];
|
|
23
|
+
extras: Record<number, boolean>;
|
|
24
|
+
dirt: number;
|
|
25
|
+
engineHealth: number;
|
|
26
|
+
bodyHealth: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const isObj = (v: unknown): v is Record<string, unknown> =>
|
|
30
|
+
typeof v === "object" && v !== null && !Array.isArray(v);
|
|
31
|
+
const nums = (v: unknown, n: number): number[] | null =>
|
|
32
|
+
Array.isArray(v) && v.length === n && v.every((x) => typeof x === "number")
|
|
33
|
+
? v
|
|
34
|
+
: null;
|
|
35
|
+
|
|
36
|
+
/** Stored or received props, checked; null when the shape is not ours. */
|
|
37
|
+
export function toVehicleProps(v: unknown): VehicleProps | null {
|
|
38
|
+
if (
|
|
39
|
+
!isObj(v) ||
|
|
40
|
+
v.v !== 1 ||
|
|
41
|
+
typeof v.model !== "number" ||
|
|
42
|
+
typeof v.plate !== "string"
|
|
43
|
+
)
|
|
44
|
+
return null;
|
|
45
|
+
const colors = nums(v.colors, 2);
|
|
46
|
+
const extraColors = nums(v.extraColors, 2);
|
|
47
|
+
const neonColor = nums(v.neonColor, 3);
|
|
48
|
+
const tyreSmoke = nums(v.tyreSmoke, 3);
|
|
49
|
+
if (
|
|
50
|
+
!colors ||
|
|
51
|
+
!extraColors ||
|
|
52
|
+
!neonColor ||
|
|
53
|
+
!tyreSmoke ||
|
|
54
|
+
!isObj(v.mods) ||
|
|
55
|
+
!isObj(v.extras) ||
|
|
56
|
+
!Array.isArray(v.neon)
|
|
57
|
+
)
|
|
58
|
+
return null;
|
|
59
|
+
const mods: Record<number, number> = {};
|
|
60
|
+
for (const [k, x] of Object.entries(v.mods))
|
|
61
|
+
if (typeof x === "number") mods[Number(k)] = x;
|
|
62
|
+
const extras: Record<number, boolean> = {};
|
|
63
|
+
for (const [k, x] of Object.entries(v.extras))
|
|
64
|
+
if (typeof x === "boolean") extras[Number(k)] = x;
|
|
65
|
+
const n = (x: unknown, d: number) => (typeof x === "number" ? x : d);
|
|
66
|
+
const rgb = (x: unknown) => nums(x, 3) as [number, number, number] | null;
|
|
67
|
+
return {
|
|
68
|
+
v: 1,
|
|
69
|
+
model: v.model,
|
|
70
|
+
plate: v.plate.slice(0, 8),
|
|
71
|
+
plateIndex: n(v.plateIndex, 0),
|
|
72
|
+
colors: [colors[0] ?? 0, colors[1] ?? 0],
|
|
73
|
+
extraColors: [extraColors[0] ?? 0, extraColors[1] ?? 0],
|
|
74
|
+
customPrimary: rgb(v.customPrimary),
|
|
75
|
+
customSecondary: rgb(v.customSecondary),
|
|
76
|
+
wheelType: n(v.wheelType, 0),
|
|
77
|
+
windowTint: n(v.windowTint, -1),
|
|
78
|
+
livery: n(v.livery, -1),
|
|
79
|
+
mods,
|
|
80
|
+
xenonColor: n(v.xenonColor, 255),
|
|
81
|
+
neon: [0, 1, 2, 3].map(
|
|
82
|
+
(i) => v.neon instanceof Array && v.neon[i] === true,
|
|
83
|
+
) as VehicleProps["neon"],
|
|
84
|
+
neonColor: [neonColor[0] ?? 255, neonColor[1] ?? 0, neonColor[2] ?? 255],
|
|
85
|
+
tyreSmoke: [tyreSmoke[0] ?? 255, tyreSmoke[1] ?? 255, tyreSmoke[2] ?? 255],
|
|
86
|
+
extras,
|
|
87
|
+
dirt: n(v.dirt, 0),
|
|
88
|
+
engineHealth: n(v.engineHealth, 1000),
|
|
89
|
+
bodyHealth: n(v.bodyHealth, 1000),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** What a freshly spawned vehicle gets on top of the model's defaults (lib `spawnVehicle`'s `setup`). */
|
|
94
|
+
export interface VehicleSetup {
|
|
95
|
+
/** Every performance mod at its top level, turbo and xenons on. */
|
|
96
|
+
maxed?: boolean;
|
|
97
|
+
/** GTA colour indexes (primary, secondary), as `VehicleProps.colors`. */
|
|
98
|
+
colors?: [number, number];
|
|
99
|
+
primary?: [number, number, number];
|
|
100
|
+
secondary?: [number, number, number];
|
|
101
|
+
livery?: number;
|
|
102
|
+
windowTint?: number;
|
|
103
|
+
/** 0 (clean) - 15. */
|
|
104
|
+
dirt?: number;
|
|
105
|
+
engineOn?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const rgbOf = (v: unknown): [number, number, number] | undefined =>
|
|
109
|
+
Array.isArray(v) &&
|
|
110
|
+
v.length === 3 &&
|
|
111
|
+
v.every((x) => typeof x === "number" && x >= 0 && x <= 255)
|
|
112
|
+
? [v[0], v[1], v[2]]
|
|
113
|
+
: undefined;
|
|
114
|
+
const intOf = (v: unknown, min: number, max: number): number | undefined =>
|
|
115
|
+
typeof v === "number" && Number.isInteger(v) && v >= min && v <= max
|
|
116
|
+
? v
|
|
117
|
+
: undefined;
|
|
118
|
+
|
|
119
|
+
const colorsOf = (v: unknown): [number, number] | undefined => {
|
|
120
|
+
if (!Array.isArray(v) || v.length !== 2) return undefined;
|
|
121
|
+
const [a, b] = [intOf(v[0], 0, 255), intOf(v[1], 0, 255)];
|
|
122
|
+
return a === undefined || b === undefined ? undefined : [a, b];
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/** A received setup, checked field by field (wrong fields drop); null when it is not an object. */
|
|
126
|
+
export function toVehicleSetup(v: unknown): VehicleSetup | null {
|
|
127
|
+
if (!isObj(v)) return null;
|
|
128
|
+
return {
|
|
129
|
+
maxed: v.maxed === true || undefined,
|
|
130
|
+
colors: colorsOf(v.colors),
|
|
131
|
+
primary: rgbOf(v.primary),
|
|
132
|
+
secondary: rgbOf(v.secondary),
|
|
133
|
+
livery: intOf(v.livery, 0, 100),
|
|
134
|
+
windowTint: intOf(v.windowTint, 0, 6),
|
|
135
|
+
dirt: intOf(v.dirt, 0, 15),
|
|
136
|
+
engineOn: v.engineOn === true || undefined,
|
|
137
|
+
};
|
|
138
|
+
}
|
package/src/shared/wait.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/** Resolves after `ms` milliseconds. */
|
|
2
|
-
export function sleep(ms: number): Promise<void> {
|
|
3
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Resolves with the first value `check` returns that is not undefined, checking once per tick (or every `intervalMs`).
|
|
8
|
-
* Rejects after `timeoutMs` (default 10 s); pass `false` to wait forever.
|
|
9
|
-
* Return `cond || undefined` from `check` to wait for a truthy condition.
|
|
10
|
-
*/
|
|
11
|
-
export function waitFor<T>(
|
|
12
|
-
check: () => T | undefined,
|
|
13
|
-
timeoutMs: number | false = 10_000,
|
|
14
|
-
intervalMs = 0,
|
|
15
|
-
): Promise<T> {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
const started = Date.now();
|
|
18
|
-
const poll = (): void => {
|
|
19
|
-
const value = check();
|
|
20
|
-
if (value !== undefined) return resolve(value);
|
|
21
|
-
if (timeoutMs !== false && Date.now() - started > timeoutMs)
|
|
22
|
-
return reject(new Error(`waitFor timed out after ${timeoutMs} ms`));
|
|
23
|
-
setTimeout(poll, intervalMs);
|
|
24
|
-
};
|
|
25
|
-
poll();
|
|
26
|
-
});
|
|
27
|
-
}
|
|
1
|
+
/** Resolves after `ms` milliseconds. */
|
|
2
|
+
export function sleep(ms: number): Promise<void> {
|
|
3
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Resolves with the first value `check` returns that is not undefined, checking once per tick (or every `intervalMs`).
|
|
8
|
+
* Rejects after `timeoutMs` (default 10 s); pass `false` to wait forever.
|
|
9
|
+
* Return `cond || undefined` from `check` to wait for a truthy condition.
|
|
10
|
+
*/
|
|
11
|
+
export function waitFor<T>(
|
|
12
|
+
check: () => T | undefined,
|
|
13
|
+
timeoutMs: number | false = 10_000,
|
|
14
|
+
intervalMs = 0,
|
|
15
|
+
): Promise<T> {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const started = Date.now();
|
|
18
|
+
const poll = (): void => {
|
|
19
|
+
const value = check();
|
|
20
|
+
if (value !== undefined) return resolve(value);
|
|
21
|
+
if (timeoutMs !== false && Date.now() - started > timeoutMs)
|
|
22
|
+
return reject(new Error(`waitFor timed out after ${timeoutMs} ms`));
|
|
23
|
+
setTimeout(poll, intervalMs);
|
|
24
|
+
};
|
|
25
|
+
poll();
|
|
26
|
+
});
|
|
27
|
+
}
|