@workadventure/room-api-client 1.24.11 → 1.25.0

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.
@@ -12,14 +12,17 @@ const roomUrl = "http://play.workadventure.localhost/_/global/maps.workadventure
12
12
  const eventName = "my-event";
13
13
  async function init() {
14
14
  // Send an event in 5 seconds
15
- setTimeout(async () => {
15
+ setTimeout(() => {
16
16
  console.log("Sending event: { foo: \"Default Value\" }");
17
- await client.broadcastEvent({
17
+ client.broadcastEvent({
18
18
  name: eventName,
19
19
  room: roomUrl,
20
20
  data: { foo: "Default Value" },
21
+ }).then(() => {
22
+ console.log("Event sent: { foo: \"Default Value\" }");
23
+ }).catch((e) => {
24
+ console.error("Error sending event:", e);
21
25
  });
22
- console.log("Event sent: { foo: \"Default Value\" }");
23
26
  }, 1000);
24
27
  // Listen a event
25
28
  const events = client.listenToEvent({
@@ -33,4 +36,4 @@ async function init() {
33
36
  break;
34
37
  }
35
38
  }
36
- init();
39
+ init().catch(e => console.error(e));
@@ -25,13 +25,14 @@ async function init() {
25
25
  console.log("Value read plain:", value);
26
26
  console.log("Value read:", struct_1.Value.unwrap(value));
27
27
  // Save a variable in 5sec
28
- setTimeout(async () => {
29
- await client.saveVariable({
28
+ setTimeout(() => {
29
+ client.saveVariable({
30
30
  name: variableName,
31
31
  room: roomUrl,
32
32
  value: "New Value",
33
- });
34
- console.log("Value saved: New Value");
33
+ }).then(() => {
34
+ console.log("Value saved: New Value");
35
+ }).catch(e => console.error(e));
35
36
  }, 5000);
36
37
  // Listen a variable
37
38
  const listenVariable = client.listenVariable({
@@ -44,4 +45,4 @@ async function init() {
44
45
  break;
45
46
  }
46
47
  }
47
- init();
48
+ init().catch(e => console.error(e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workadventure/room-api-client",
3
- "version": "v1.24.11",
3
+ "version": "v1.25.0",
4
4
  "description": "Workadventure Room Api Client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,10 +12,10 @@
12
12
  "build": "tsc --build",
13
13
  "example-variables": "tsx ./src/example_variables.ts",
14
14
  "example-events": "tsx ./src/example_events.ts",
15
- "lint": "eslint --ext .js,.ts .",
16
- "lint-fix": "eslint --fix --ext .js,.ts .",
17
- "format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
18
- "format-check": "prettier --ignore-path .gitignore \"**/*.+(js|ts|json)\"",
15
+ "lint": "eslint src/",
16
+ "lint-fix": "eslint --fix src/",
17
+ "pretty": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
18
+ "pretty-check": "prettier --ignore-path .gitignore \"**/*.+(js|ts|json)\"",
19
19
  "precommit": "lint-staged"
20
20
  },
21
21
  "repository": {
@@ -41,16 +41,13 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^18.15.5",
44
- "@typescript-eslint/eslint-plugin": "^5.56.0",
45
- "@typescript-eslint/parser": "^5.56.0",
46
- "eslint": "^8.36.0",
47
- "eslint-config-prettier": "^8.8.0",
48
- "eslint-plugin-rxjs": "^5.0.3",
44
+ "@workadventure/eslint-config": "file:../../eslint-config",
45
+ "eslint": "^9.25.1",
49
46
  "grpc-tools": "^1.12.4",
50
47
  "lint-staged": "^13.2.0",
51
48
  "prettier": "^2.8.6",
52
49
  "ts-proto": "^2.4.2",
53
- "tsx": "^4.7.0",
50
+ "tsx": "^4.7.1",
54
51
  "typescript": "^5.0.2"
55
52
  },
56
53
  "lint-staged": {