@nativewrappers/fivem 0.0.138 → 0.0.139

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,6 +1,25 @@
1
1
  type ResourceName = string;
2
2
  type ResourceOrGlobal = ResourceName | "global";
3
+ type FunctionCall = (resource_name?: string) => void;
4
+ declare class ResourceWrapper {
5
+ #private;
6
+ /**
7
+ * Adds a function to get called whenever a resource is started
8
+ * @param resource_name The resource name to add to the start listener.
9
+ * @param fn The function to call
10
+ */
11
+ add_to_resource_start(resource_name: ResourceOrGlobal, fn: FunctionCall): void;
12
+ /**
13
+ * Adds a function to get called whenever a resource is stopped
14
+ * @param resource_name The resource name to add to the stop listener.
15
+ * @param fn The function to call
16
+ */
17
+ add_to_resource_stop(resource_name: ResourceOrGlobal, fn: FunctionCall): void;
18
+ private on_resource_start;
19
+ private on_resource_stop;
20
+ }
3
21
  export declare const EnsureResourceWrapperInit: () => void;
22
+ export declare const GetResourceWrapper: () => ResourceWrapper;
4
23
  /**
5
24
  * Called whenever the specified resource is started, this will be called once on once on resource start if the resource is started.
6
25
  * NOTE: If you want to listen to *all* resource start/stop events you should send
@@ -74,6 +74,10 @@ const EnsureResourceWrapperInit = /* @__PURE__ */ __name(() => {
74
74
  globalThis.RESOURCE_WRAPPER = new ResourceWrapper();
75
75
  }
76
76
  }, "EnsureResourceWrapperInit");
77
+ const GetResourceWrapper = /* @__PURE__ */ __name(() => {
78
+ EnsureResourceWrapperInit();
79
+ return globalThis.RESOURCE_WRAPPER;
80
+ }, "GetResourceWrapper");
77
81
  EnsureResourceWrapperInit();
78
82
  const RESOURCE_WRAPPER = globalThis.RESOURCE_WRAPPER;
79
83
  const onResourceStart = /* @__PURE__ */ __name((resource, originalMethod) => {
@@ -114,6 +118,7 @@ function OnResourceStop(resource = GetCurrentResourceName()) {
114
118
  __name(OnResourceStop, "OnResourceStop");
115
119
  export {
116
120
  EnsureResourceWrapperInit,
121
+ GetResourceWrapper,
117
122
  OnResourceStart,
118
123
  OnResourceStop
119
124
  };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.138",
11
+ "version": "0.0.139",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"