@aguacerowx/javascript-sdk 0.0.26 → 0.0.27

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aguacerowx/javascript-sdk",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -1114,7 +1114,7 @@ export class AguaceroCore extends EventEmitter {
1114
1114
 
1115
1115
  // --- Data and Calculation Methods ---
1116
1116
 
1117
- _ensureGridDecodeWorker() {
1117
+ async _ensureGridDecodeWorker() {
1118
1118
  if (this._gridDecodeWorkerDisabled) {
1119
1119
  return null;
1120
1120
  }
@@ -1126,9 +1126,8 @@ export class AguaceroCore extends EventEmitter {
1126
1126
  return null;
1127
1127
  }
1128
1128
  try {
1129
- this._gridDecodeWorker = new Worker(new URL('./gridDecodeWorker.js', import.meta.url), {
1130
- type: 'module',
1131
- });
1129
+ const { spawnGridDecodeWorker } = await import('./spawnGridDecodeWorker.js');
1130
+ this._gridDecodeWorker = spawnGridDecodeWorker();
1132
1131
  this._gridDecodeWorker.addEventListener('error', () => {
1133
1132
  this._gridDecodeWorkerDisabled = true;
1134
1133
  if (this._gridDecodeWorker) {
@@ -1148,10 +1147,10 @@ export class AguaceroCore extends EventEmitter {
1148
1147
  * {@link processCompressedGrid}. Uses a copy for postMessage transfer so the original `compressedData`
1149
1148
  * stays valid if the Worker path fails.
1150
1149
  */
1151
- _decodeGridPayload(compressedData, encoding) {
1152
- const worker = this._ensureGridDecodeWorker();
1150
+ async _decodeGridPayload(compressedData, encoding) {
1151
+ const worker = await this._ensureGridDecodeWorker();
1153
1152
  if (!worker) {
1154
- return Promise.resolve(processCompressedGrid(compressedData, encoding));
1153
+ return processCompressedGrid(compressedData, encoding);
1155
1154
  }
1156
1155
  const payload = compressedData.slice();
1157
1156
  return new Promise((resolve, reject) => {
@@ -0,0 +1,5 @@
1
+ export function spawnGridDecodeWorker() {
2
+ return new Worker(new URL('./gridDecodeWorker.js', import.meta.url), {
3
+ type: 'module',
4
+ });
5
+ }