@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.mjs
CHANGED
|
@@ -125,13 +125,21 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
125
125
|
}\r
|
|
126
126
|
};\r
|
|
127
127
|
\r
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
const shouldIgnoreError = (error) => {
|
|
129
|
+
const message = error && error.message ? error.message : String(error || '');
|
|
130
|
+
return message.includes('ResizeObserver loop');
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
window.addEventListener('error', (event) => {
|
|
134
|
+
const error = event.error || event.message;
|
|
135
|
+
if (shouldIgnoreError(error)) return;
|
|
136
|
+
reportError(error, 'window.error');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
window.addEventListener('unhandledrejection', (event) => {
|
|
140
|
+
if (shouldIgnoreError(event.reason)) return;
|
|
141
|
+
reportError(event.reason, 'unhandledrejection');
|
|
142
|
+
});
|
|
135
143
|
\r
|
|
136
144
|
const clearViewer = () => {\r
|
|
137
145
|
while (viewer.firstChild) {\r
|
|
@@ -394,8 +402,12 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
394
402
|
});\r
|
|
395
403
|
\r
|
|
396
404
|
const getPageIndex = (dest) => {\r
|
|
397
|
-
if (
|
|
405
|
+
if (!dest) return null;\r
|
|
398
406
|
if (typeof dest === 'string') return getSpineIndexByHref(dest);\r
|
|
407
|
+
if (typeof dest !== 'object') return null;\r
|
|
408
|
+
if (dest.kind === 'href') return getSpineIndexByHref(dest.value);\r
|
|
409
|
+
if (dest.kind === 'pageIndex') return dest.value;\r
|
|
410
|
+
if (dest.kind === 'pageNumber') return Math.max(0, dest.value - 1);\r
|
|
399
411
|
return null;\r
|
|
400
412
|
};\r
|
|
401
413
|
\r
|
|
@@ -522,6 +534,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
522
534
|
if (raw && typeof raw === 'object' && raw.kind && raw.id) {
|
|
523
535
|
message = raw;
|
|
524
536
|
} else if (typeof raw === 'string') {
|
|
537
|
+
if (raw.startsWith('setImmediate$')) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
525
540
|
const trimmed = raw.trim();
|
|
526
541
|
if (!trimmed || (!trimmed.startsWith('{') && !trimmed.startsWith('['))) {
|
|
527
542
|
return;
|
|
@@ -529,18 +544,15 @@ https://github.com/nodeca/pako/blob/main/LICENSE\r
|
|
|
529
544
|
try {
|
|
530
545
|
message = JSON.parse(trimmed);
|
|
531
546
|
} catch (err) {
|
|
532
|
-
sendEvent('RUNTIME_ERROR', {
|
|
533
|
-
message: 'Failed to parse message'
|
|
534
|
-
context: 'runtime.onMessage'
|
|
535
|
-
stack: err && err.stack ? err.stack : null
|
|
536
|
-
preview: trimmed.slice(0, 200)
|
|
537
|
-
})
|
|
538
|
-
return
|
|
539
|
-
}
|
|
547
|
+
sendEvent('RUNTIME_ERROR', {\r
|
|
548
|
+
message: 'Failed to parse message',\r
|
|
549
|
+
context: 'runtime.onMessage',\r
|
|
550
|
+
stack: err && err.stack ? err.stack : null,\r
|
|
551
|
+
preview: trimmed.slice(0, 200),\r
|
|
552
|
+
});\r
|
|
553
|
+
return;\r
|
|
554
|
+
}\r
|
|
540
555
|
} else {
|
|
541
|
-
sendEvent('RUNTIME_LOG', {
|
|
542
|
-
message: \`Ignoring message of type \${typeof raw}\`,
|
|
543
|
-
});
|
|
544
556
|
return;
|
|
545
557
|
}
|
|
546
558
|
\r
|