@nativewrappers/fivem 0.0.15 → 0.0.16

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.
@@ -3,9 +3,9 @@ export declare class Events {
3
3
  /**
4
4
  * An onNet wrapper that properly converts the type into the correct type
5
5
  */
6
- onNet: (eventName: string, event: NetEvent) => void;
6
+ static onNet: (eventName: string, event: NetEvent) => void;
7
7
  /**
8
8
  * An on wrapper that properly converts the classes
9
9
  */
10
- on: (eventName: string, event: NetEvent) => void;
10
+ static on: (eventName: string, event: NetEvent) => void;
11
11
  }
package/client/Events.js CHANGED
@@ -51,23 +51,23 @@ const getClassFromArguments = (...args) => {
51
51
  }
52
52
  return newArgs;
53
53
  };
54
+ // TODO: Add a third argument to enable recursive decent and change any
55
+ // object/array to its proper type
54
56
  export class Events {
55
- constructor() {
56
- /**
57
- * An onNet wrapper that properly converts the type into the correct type
58
- */
59
- this.onNet = (eventName, event) => {
60
- onNet(eventName, (...args) => {
61
- event(...getClassFromArguments(...args));
62
- });
63
- };
64
- /**
65
- * An on wrapper that properly converts the classes
66
- */
67
- this.on = (eventName, event) => {
68
- on(eventName, (...args) => {
69
- event(...getClassFromArguments(...args));
70
- });
71
- };
72
- }
73
57
  }
58
+ /**
59
+ * An onNet wrapper that properly converts the type into the correct type
60
+ */
61
+ Events.onNet = (eventName, event) => {
62
+ onNet(eventName, (...args) => {
63
+ event(...getClassFromArguments(...args));
64
+ });
65
+ };
66
+ /**
67
+ * An on wrapper that properly converts the classes
68
+ */
69
+ Events.on = (eventName, event) => {
70
+ on(eventName, (...args) => {
71
+ event(...getClassFromArguments(...args));
72
+ });
73
+ };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Remco Troost <d0p3t>",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "version": "0.0.15",
7
+ "version": "0.0.16",
8
8
  "publishConfig": {
9
9
  "directory": "lib"
10
10
  },
@@ -7,9 +7,9 @@ export declare class Events {
7
7
  /**
8
8
  * An onNet wrapper that properly converts the type into the correct type
9
9
  */
10
- onNet: (eventName: string, event: NetEvent) => void;
10
+ static onNet: (eventName: string, event: NetEvent) => void;
11
11
  /**
12
12
  * An on wrapper that properly converts the classes
13
13
  */
14
- on: (eventName: string, event: NetEvent) => void;
14
+ static on: (eventName: string, event: NetEvent) => void;
15
15
  }
package/server/Events.js CHANGED
@@ -47,26 +47,6 @@ const getClassFromArguments = (...args) => {
47
47
  return newArgs;
48
48
  };
49
49
  export class Events {
50
- constructor() {
51
- /**
52
- * An onNet wrapper that properly converts the type into the correct type
53
- */
54
- this.onNet = (eventName, event) => {
55
- onNet(eventName, (...args) => {
56
- const ply = new Player(source);
57
- event(ply, ...getClassFromArguments(...args));
58
- });
59
- };
60
- /**
61
- * An on wrapper that properly converts the classes
62
- */
63
- this.on = (eventName, event) => {
64
- on(eventName, (...args) => {
65
- const ply = new Player(source);
66
- event(ply, ...getClassFromArguments(...args));
67
- });
68
- };
69
- }
70
50
  static cancel() {
71
51
  CancelEvent();
72
52
  }
@@ -77,3 +57,21 @@ export class Events {
77
57
  return GetInvokingResource();
78
58
  }
79
59
  }
60
+ /**
61
+ * An onNet wrapper that properly converts the type into the correct type
62
+ */
63
+ Events.onNet = (eventName, event) => {
64
+ onNet(eventName, (...args) => {
65
+ const ply = new Player(source);
66
+ event(ply, ...getClassFromArguments(...args));
67
+ });
68
+ };
69
+ /**
70
+ * An on wrapper that properly converts the classes
71
+ */
72
+ Events.on = (eventName, event) => {
73
+ on(eventName, (...args) => {
74
+ const ply = new Player(source);
75
+ event(ply, ...getClassFromArguments(...args));
76
+ });
77
+ };