@momo2555/koppeliajs 0.0.168 → 0.0.170

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.
@@ -33,14 +33,19 @@ export declare class Device {
33
33
  onEvent(eventName: string, callback: () => void): string;
34
34
  /**
35
35
  * Enables the cursor module and listens for coordinate updates.
36
- * @param callback Function to execute with the incoming (x, y) coordinates.
36
+ * @param callback Function to execute with the incoming (x, y, a) coordinates.
37
37
  */
38
- onCursor(callback: (x: number, y: number) => void): string;
38
+ onCursor(callback: (x: number, y: number, a: number) => void): string;
39
39
  /**
40
40
  * Enables the biking module and listens for speed updates.
41
41
  * @param callback Function to execute with the incoming speed data.
42
42
  */
43
43
  onBiking(callback: (speed: number) => void): string;
44
+ /**
45
+ * Enables the biking module and listens for speed updates.
46
+ * @param callback Function to execute with the incoming speed data.
47
+ */
48
+ onRotation(callback: (omega: number) => void): string;
44
49
  /**
45
50
  * Enables the vertical detector module and listens for orientation updates.
46
51
  * @param callback Function to execute with the boolean vertical state.
@@ -50,14 +50,14 @@ export class Device {
50
50
  }
51
51
  /**
52
52
  * Enables the cursor module and listens for coordinate updates.
53
- * @param callback Function to execute with the incoming (x, y) coordinates.
53
+ * @param callback Function to execute with the incoming (x, y, a) coordinates.
54
54
  */
55
55
  onCursor(callback) {
56
56
  this._enableModule("cursor");
57
57
  this._attachEvent("cursor");
58
58
  let callbackId = this._console.onRequest((request, params, form, address) => {
59
59
  if (request == "cursor" && address == this._address) {
60
- callback(params.x, params.y);
60
+ callback(params.x, params.y, params.a);
61
61
  }
62
62
  });
63
63
  this._callbackIds.push(callbackId);
@@ -78,6 +78,21 @@ export class Device {
78
78
  this._callbackIds.push(callbackId);
79
79
  return callbackId;
80
80
  }
81
+ /**
82
+ * Enables the biking module and listens for speed updates.
83
+ * @param callback Function to execute with the incoming speed data.
84
+ */
85
+ onRotation(callback) {
86
+ this._enableModule("rot");
87
+ this._attachEvent("rotation");
88
+ let callbackId = this._console.onRequest((request, params, form, address) => {
89
+ if (request == "rotation" && address == this._address) {
90
+ callback(params.omega);
91
+ }
92
+ });
93
+ this._callbackIds.push(callbackId);
94
+ return callbackId;
95
+ }
81
96
  /**
82
97
  * Enables the vertical detector module and listens for orientation updates.
83
98
  * @param callback Function to execute with the boolean vertical state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo2555/koppeliajs",
3
- "version": "0.0.168",
3
+ "version": "0.0.170",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",