desktopr 1.2.2 → 1.2.3

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.
@@ -46,17 +46,20 @@ const newWindow = async (core, options) => {
46
46
  };
47
47
  exports.newWindow = newWindow;
48
48
  const closeWindow = async (core, label) => {
49
+ const trimmedLabel = (label?.trim()) ?? "";
50
+ const _label = trimmedLabel ?? "main";
49
51
  try {
50
- const usedLabelsJSON = await sdk_1.Desktopr.globalVariables.get(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME);
51
- let usedLabelsObj = await JSON.parse(usedLabelsJSON);
52
- if (label)
53
- delete usedLabelsObj[label];
54
- const updatedUsedLabelsJSON = JSON.stringify(usedLabelsObj);
55
- await sdk_1.Desktopr.globalVariables.set(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
52
+ if (trimmedLabel) {
53
+ const usedLabelsJSON = await sdk_1.Desktopr.globalVariables.get(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME);
54
+ let usedLabelsObj = await JSON.parse(usedLabelsJSON);
55
+ delete usedLabelsObj[trimmedLabel];
56
+ const updatedUsedLabelsJSON = JSON.stringify(usedLabelsObj);
57
+ await sdk_1.Desktopr.globalVariables.set(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
58
+ }
56
59
  }
57
60
  catch (error) {
58
61
  console.warn("Could not update used windows labels tracker");
59
62
  }
60
- core.invoke("dtr_win_close", { label });
63
+ core.invoke("dtr_win_close", { _label });
61
64
  };
62
65
  exports.closeWindow = closeWindow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desktopr",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Official JS/TS SDK for the Desktopr native bridge",
5
5
  "main": "dist-sdk/sdk/index.js",
6
6
  "types": "dist-sdk/sdk/index.d.ts",