@momo2555/koppeliajs 0.0.95 → 0.0.96

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.
@@ -43,13 +43,19 @@ export declare class Koppelia {
43
43
  */
44
44
  getGameId(): string;
45
45
  /**
46
- * Get the list of plays
46
+ * Get the list of plays, the plays returned by this function doesn't include the raw
47
+ * You have to call a function in from the play object to download all the raw files
47
48
  * @param count limit of plays to get
48
49
  * @param index index from which to start fetching the plays
49
50
  * @param orderBy order by date or name
50
- * @returns the List of plays an array of objects of type Play
51
+ * @returns the List of plays an array of objects of type Play,
51
52
  */
52
53
  getPlays(count?: number, index?: number, orderBy?: string): Promise<Play[]>;
54
+ /**
55
+ * Get the current play that has been set
56
+ * @returns the current play
57
+ */
58
+ getCurrentPlay(): Promise<Play>;
53
59
  /**
54
60
  * This function enables the difficulty cursor, to change the difficulty in live when playing from Koppeli'App
55
61
  * @param callback : callback to call when difficulty changes
@@ -113,11 +113,12 @@ export class Koppelia {
113
113
  return PUBLIC_GAME_ID;
114
114
  }
115
115
  /**
116
- * Get the list of plays
116
+ * Get the list of plays, the plays returned by this function doesn't include the raw
117
+ * You have to call a function in from the play object to download all the raw files
117
118
  * @param count limit of plays to get
118
119
  * @param index index from which to start fetching the plays
119
120
  * @param orderBy order by date or name
120
- * @returns the List of plays an array of objects of type Play
121
+ * @returns the List of plays an array of objects of type Play,
121
122
  */
122
123
  async getPlays(count = 10, index = 0, orderBy = "date") {
123
124
  return new Promise((resolve, reject) => {
@@ -138,6 +139,23 @@ export class Koppelia {
138
139
  });
139
140
  });
140
141
  }
142
+ /**
143
+ * Get the current play that has been set
144
+ * @returns the current play
145
+ */
146
+ async getCurrentPlay() {
147
+ return new Promise((resolve, reject) => {
148
+ let getCuurentPlayRequest = new Message();
149
+ getCuurentPlayRequest.setRequest("getCurrentPlay");
150
+ getCuurentPlayRequest.setDestination(PeerType.MASTER, "");
151
+ this._console.sendMessage(getCuurentPlayRequest, (response) => {
152
+ let playData = response.getParam("play", {});
153
+ let playId = response.getParam("playId", "");
154
+ let play = new Play(this._console, playId, playData);
155
+ resolve(play);
156
+ });
157
+ });
158
+ }
141
159
  /**
142
160
  * This function enables the difficulty cursor, to change the difficulty in live when playing from Koppeli'App
143
161
  * @param callback : callback to call when difficulty changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo2555/koppeliajs",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",