@zerochain/sdk
Version:
The Züs JS SDK is a JavaScript client library that provides a convenient interface for interacting with the Züs Network. It allows developers to perform various operations such as creating and managing allocations, uploading and downloading files, executi
33 lines (28 loc) • 675 B
text/typescript
import {
createWasmLoader,
type InitializeWasm,
type WasmLoaderOptions,
} from './createWasmLoader'
let retries = 0
export const wasmLoader = ({
onLog,
debounceTimeout,
setIsWasmLoaded,
}: {
onLog?: WasmLoaderOptions['onLog']
debounceTimeout?: WasmLoaderOptions['debounceTimeout']
setIsWasmLoaded?: WasmLoaderOptions['setIsWasmLoaded']
}): InitializeWasm => {
const getRetries = () => retries
const incrementRetries = () => retries++
const resetRetries = () => (retries = 0)
const loadWasm = createWasmLoader({
onLog,
debounceTimeout,
setIsWasmLoaded,
getRetries,
incrementRetries,
resetRetries,
})
return loadWasm
}