JS SDK
This page will specifically guide you through setting up a project using the Züs JS SDK. For detailed API documentation, please refer to the API Reference.
Install Züs JS SDK
The Züs JS SDK is available as a package on NPM for use with a module bundler:
Initialize the SDK
Before using the SDK, it must be initialized. This process involves loading the required scripts, fetching the appropriate WASM file, and then initializing the WASM.
Adding Required Scripts
Include the following scripts in the <head>
of your HTML:
Fetching the WASM
There are two WASM file types available, standard
and enterprise
.
Download the appropriate WASM file(s):
Standard WASM is for interacting with a Standard Allocation:
Enterprise WASM is for interacting with an Enterprise Allocation:
Upload your WASM file for
wasmBaseUrl
config:You can place it in your website’s static assets folder.
In this case, set the
wasmBaseUrl
config to/wasm
.
Alternatively, you can upload it to a web server or CDN.
For example, if
wasmBaseUrl
is set tohttps://example.com/wasm
, the WASM files should be located at:https://example.com/wasm/enterprise-zcn.wasm
for the Enterprise WASMhttps://example.com/wasm/zcn.wasm
for the Standard WASM
This is optional if you are not using upload features of the SDK. This includes using SDK methods like
multiUpload
andbulkUpload
. {/* DOTODO: update link to multiUpload and bulkUpload */}Place it in your website’s static assets folder:
In this case, set the
md5WorkerUrl
config tomd5worker.js
.
Fetching WASM with Caching Support
The SDK supports caching the WASM file for faster access. This is not enabled by default, but you can modify the loadWasm
config to enable it.
Set
useCachedWasm
totrue
.Configure
cacheConfig
based on your WASM file type:For Enterprise WASM, set
enterpriseGosdkVersion
andenterpriseWasmUrl
.For Standard WASM, set
standardGosdkVersion
andstandardWasmUrl
.
Optionally, set
wasmBaseUrl
as a fallback. (Reference)
Switching between WASM modes
The SDK provides updateWasmMode
for switching between WASM modes.
First call
updateWasmMode
with the desired WASM mode.Then call
loadWasm
with the proper config.
Next Steps
Now that the SDK is initialized, you can start using its methods in your application. Check out the API Reference.
Example: Logging the WASM version
Last updated