chore: use singleton loader to prevent duplicated wasm request

This commit is contained in:
鲁树人 2023-05-10 23:16:12 +01:00
parent fc2238ff39
commit 24a68fcf59
3 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,7 @@
"@chakra-ui/react": "^2.6.1", "@chakra-ui/react": "^2.6.1",
"@emotion/react": "^11.11.0", "@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@jixun/libparakeet": "0.0.0-exp5", "@jixun/libparakeet": "0.0.0-exp6",
"@reduxjs/toolkit": "^1.9.5", "@reduxjs/toolkit": "^1.9.5",
"framer-motion": "^10.12.8", "framer-motion": "^10.12.8",
"nanoid": "^4.0.2", "nanoid": "^4.0.2",

View File

@ -14,8 +14,8 @@ dependencies:
specifier: ^11.11.0 specifier: ^11.11.0
version: 11.11.0(@emotion/react@11.11.0)(@types/react@18.0.28)(react@18.2.0) version: 11.11.0(@emotion/react@11.11.0)(@types/react@18.0.28)(react@18.2.0)
'@jixun/libparakeet': '@jixun/libparakeet':
specifier: 0.0.0-exp5 specifier: 0.0.0-exp6
version: 0.0.0-exp5 version: 0.0.0-exp6
'@reduxjs/toolkit': '@reduxjs/toolkit':
specifier: ^1.9.5 specifier: ^1.9.5
version: 1.9.5(react-redux@8.0.5)(react@18.2.0) version: 1.9.5(react-redux@8.0.5)(react@18.2.0)
@ -1780,8 +1780,8 @@ packages:
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
dev: true dev: true
/@jixun/libparakeet@0.0.0-exp5: /@jixun/libparakeet@0.0.0-exp6:
resolution: {integrity: sha512-qDGhEYEDUCl3GvpeVfBU7Jd6KuONULQUaA/SpBdKDT5sSuM+fgLIAwD7gxaR+Rp05QGLnG6VNKoLXMmvuW9JPQ==} resolution: {integrity: sha512-hxItnn7nMKnmgSEnFXtbkud9KmxtQrBQzM/oMRpl4hfgVL0PxnTMJtoyKCYR0MGOuQ/+M+Ehc8rLi4Ex/rRdTg==}
dev: false dev: false
/@jridgewell/gen-mapping@0.3.3: /@jridgewell/gen-mapping@0.3.3:

View File

@ -1,7 +1,7 @@
import { LibParakeetInit, BlobSink, createArrayBufferReader } from '@jixun/libparakeet'; import { loadLibParakeet, BlobSink, createArrayBufferReader } from '@jixun/libparakeet';
function testWasm() { function testWasm() {
LibParakeetInit().then(async (mod) => { loadLibParakeet().then(async (mod) => {
const data = new Uint8Array(0x2000); const data = new Uint8Array(0x2000);
for (let i = 0; i < data.byteLength; i++) { for (let i = 0; i < data.byteLength; i++) {
data[i] = i & 0xff; data[i] = i & 0xff;