@papyrus-sdk/ui-react-native 0.1.2 → 0.1.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.
- package/dist/index.js +31 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/runtime/index.html +31 -19
- package/runtime/runtime.js +29 -11
package/dist/index.js
CHANGED
|
@@ -151,13 +151,21 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
151
151
|
}\r
|
|
152
152
|
};\r
|
|
153
153
|
\r
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
const shouldIgnoreError = (error) => {
|
|
155
|
+
const message = error && error.message ? error.message : String(error || '');
|
|
156
|
+
return message.includes('ResizeObserver loop');
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
window.addEventListener('error', (event) => {
|
|
160
|
+
const error = event.error || event.message;
|
|
161
|
+
if (shouldIgnoreError(error)) return;
|
|
162
|
+
reportError(error, 'window.error');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
window.addEventListener('unhandledrejection', (event) => {
|
|
166
|
+
if (shouldIgnoreError(event.reason)) return;
|
|
167
|
+
reportError(event.reason, 'unhandledrejection');
|
|
168
|
+
});
|
|
161
169
|
\r
|
|
162
170
|
const clearViewer = () => {\r
|
|
163
171
|
while (viewer.firstChild) {\r
|
|
@@ -420,8 +428,12 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
420
428
|
});\r
|
|
421
429
|
\r
|
|
422
430
|
const getPageIndex = (dest) => {\r
|
|
423
|
-
if (
|
|
431
|
+
if (!dest) return null;\r
|
|
424
432
|
if (typeof dest === 'string') return getSpineIndexByHref(dest);\r
|
|
433
|
+
if (typeof dest !== 'object') return null;\r
|
|
434
|
+
if (dest.kind === 'href') return getSpineIndexByHref(dest.value);\r
|
|
435
|
+
if (dest.kind === 'pageIndex') return dest.value;\r
|
|
436
|
+
if (dest.kind === 'pageNumber') return Math.max(0, dest.value - 1);\r
|
|
425
437
|
return null;\r
|
|
426
438
|
};\r
|
|
427
439
|
\r
|
|
@@ -548,6 +560,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
548
560
|
if (raw && typeof raw === 'object' && raw.kind && raw.id) {
|
|
549
561
|
message = raw;
|
|
550
562
|
} else if (typeof raw === 'string') {
|
|
563
|
+
if (raw.startsWith('setImmediate$')) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
551
566
|
const trimmed = raw.trim();
|
|
552
567
|
if (!trimmed || (!trimmed.startsWith('{') && !trimmed.startsWith('['))) {
|
|
553
568
|
return;
|
|
@@ -555,18 +570,15 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
555
570
|
try {
|
|
556
571
|
message = JSON.parse(trimmed);
|
|
557
572
|
} catch (err) {
|
|
558
|
-
sendEvent('RUNTIME_ERROR', {
|
|
559
|
-
message: 'Failed to parse message'
|
|
560
|
-
context: 'runtime.onMessage'
|
|
561
|
-
stack: err && err.stack ? err.stack : null
|
|
562
|
-
preview: trimmed.slice(0, 200)
|
|
563
|
-
})
|
|
564
|
-
return
|
|
565
|
-
}
|
|
573
|
+
sendEvent('RUNTIME_ERROR', {\r
|
|
574
|
+
message: 'Failed to parse message',\r
|
|
575
|
+
context: 'runtime.onMessage',\r
|
|
576
|
+
stack: err && err.stack ? err.stack : null,\r
|
|
577
|
+
preview: trimmed.slice(0, 200),\r
|
|
578
|
+
});\r
|
|
579
|
+
return;\r
|
|
580
|
+
}\r
|
|
566
581
|
} else {
|
|
567
|
-
sendEvent('RUNTIME_LOG', {
|
|
568
|
-
message: \`Ignoring message of type \${typeof raw}\`,
|
|
569
|
-
});
|
|
570
582
|
return;
|
|
571
583
|
}
|
|
572
584
|
\r
|