UNPKG

@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

36 lines (35 loc) 1.95 kB
import type { OnLog } from '@/types/log'; import type { Config } from '../createWasm/bridge'; import type { WasmType } from '@/types'; export type WasmLoaderOptions = { onLog?: OnLog | undefined; debounceTimeout?: number | undefined; setIsWasmLoaded?: ((isWasmLoaded: boolean) => void) | undefined; getRetries: () => number; incrementRetries: () => void; resetRetries: () => void; }; export type InitializeWasm = (config: Config, isSwitchingWasm?: boolean) => Promise<void> | undefined; export declare const createWasmLoader: ({ onLog, debounceTimeout, setIsWasmLoaded, getRetries, incrementRetries, resetRetries, }: WasmLoaderOptions) => InitializeWasm; /** Updates the "desired mode" value of the GoSDK WASM. */ export declare const updateWasmMode: (desiredAllocationType: WasmType) => void; /** Returns the "desired mode" value of the GoSDK WASM. */ export declare const getDesiredMode: () => WasmType; /** * Checks if the desired GoSDK WASM mode is initialized. Returns `true` if the WASM is initialized, `false` otherwise. * @param onLog Optional logger, e.g., console.log */ export declare const isDesiredWasmInitialized: (onLog?: OnLog) => boolean; /** * Waits until the GoSDK WASM is loaded and initialized. * * Unlike `checkIfWasmLoaded` method, this method doesn't check if the desired WASM mode is initialized. It just returns a promise that will only resolve once the GoSDK WASM is loaded and initialized. * * @param onLog Optional logger, e.g., console.log */ export declare const awaitWasmLoad: (onLog?: OnLog) => Promise<void>; /** * `checkIfWasmLoaded` Waits for the "desired mode" GoSDK WASM to be loaded and initialized. * @returns {Promise<boolean>} Returns a promise that resolves to `true` until the "desired mode" GoSDK WASM is loaded and initialized. If the desired WASM mode is not initialized, it resolves to `false`. */ export declare const checkIfWasmLoaded: () => Promise<boolean>;