Class: LibraryUtils

LibraryUtils

Collection of helper utilities for the library.

Methods

(static) getLogLevel() → {int}

Get the library's log level.
Source:
Returns:
the library's log level
Type
int

(async, static) getWasmMemoryUsed() → {int}

Get the total memory used by WebAssembly.
Source:
Returns:
the total memory used by WebAssembly
Type
int

(static) getWasmModule()

Get the WebAssembly module in the current context (nodejs, browser main thread or worker).
Source:

(async, static) getWorker() → {Worker}

Get a singleton instance of a worker to share.
Source:
Returns:
a worker to share among wallet instances
Type
Worker

(async, static) invokeWorker(identifies, fnName, args) → {Promise}

Invoke a worker function and get the result with error handling.
Parameters:
Name Type Description
identifies objectId the worker object to invoke
fnName string is the name of the function to invoke
args Array.<Object> are function arguments to invoke with
Source:
Returns:
resolves with response payload from the worker or an error
Type
Promise

(static) isRejectUnauthorized(fnId)

Indicate if unauthorized requests should be rejected.
Parameters:
Name Type Description
fnId string uniquely identifies the function
Source:

(async, static) loadFullModule()

Load the WebAssembly full module with caching. The full module is a superset of the keys module and overrides it. TODO: this is separate static function from loadKeysModule() because webpack cannot bundle worker using runtime param for conditional import
Source:

(async, static) loadKeysModule()

Load the WebAssembly keys module with caching.
Source:

(static) log(level, msg)

Log a message.
Parameters:
Name Type Description
level int log level of the message
msg string message to log
Source:

(async, static) setLogLevel(level)

Set the library's log level with 0 being least verbose.
Parameters:
Name Type Description
level int the library's log level
Source:

(static) setRejectUnauthorizedFn(fnId, fn)

Register a function by id which informs if unauthorized requests (e.g. self-signed certificates) should be rejected.
Parameters:
Name Type Description
fnId string unique identifier for the function
fn function function to inform if unauthorized requests should be rejected
Source:

(static) setWorkerDistPath(workerDistPath)

Set the path to load the worker. Defaults to "/monero_web_worker.js" in the browser and "./MoneroWebWorker.js" in node.
Parameters:
Name Type Description
workerDistPath string path to load the worker
Source: