@trippler/tr_lib 2.9.0 → 2.9.1

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.
@@ -1,2 +1,2 @@
1
- declare const _default: (Function: () => void) => Promise<boolean>;
1
+ declare const _default: (Function: () => void) => Promise<unknown>;
2
2
  export default _default;
@@ -1,6 +1,11 @@
1
1
  import onNuiCallback from "../nuiCallback/onNuiCallback";
2
2
  let domLoaded = false;
3
- onNuiCallback('__DOMLoaded', () => domLoaded = true);
3
+ const waitingCallbacks = [];
4
+ onNuiCallback('__DOMLoaded', () => {
5
+ domLoaded = true;
6
+ waitingCallbacks.forEach(fn => fn());
7
+ waitingCallbacks.length = 0;
8
+ });
4
9
  export default (Function) => {
5
10
  return new Promise(resolve => {
6
11
  if (domLoaded) {
@@ -8,7 +13,7 @@ export default (Function) => {
8
13
  resolve(true);
9
14
  }
10
15
  else {
11
- onNuiCallback('__DOMLoaded', () => {
16
+ waitingCallbacks.push(() => {
12
17
  Function();
13
18
  resolve(true);
14
19
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trippler/tr_lib",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "A lightweight utility & helper library for FiveM developers. Designed to improve code reusability, consistency, and performance across and outcross Trippler resources.",
5
5
  "author": "Trippler",
6
6
  "license": "GPL-3.0",