spot-client/src/spot-remote/ultrasound/ultrasoundService.js
/**
     * Loads the external file dependencies for the ultrasound library. The
     * files are loaded dynamically as they are large.
     *
     * @param {string} emscriptenPath - The url path, excluding the filename,
     * for the emscripten used by lib-quiet-js.
     * @param {string} memoryInitializerPath - The url path, excluding the
     * filename, for the memory file dynamically loaded by the emscripten.
     * @param {number} transmissionDelay - The amount of time in milliseconds to
     * wait between transmitting an ultrasound message.
     * @returns {Promise} Resolves when the ultrasound library is ready to use.
     */
Loads the external file dependencies for the ultrasound library. The
files are loaded dynamically as they are large.

@param {string} emscriptenPath - The url path, excluding the filename,
for the emscripten used by lib-quiet-js.
@param {string} memoryInitializerPath - The url path, excluding the
filename, for the memory file dynamically loaded by the emscripten.
@param {number} transmissionDelay - The amount of time in milliseconds to
wait between transmitting an ultrasound message.
@returns {Promise} Resolves when the ultrasound library is ready to use.
Loads the external file dependencies for the ultrasound library . The files are loaded dynamically as they are large . @param { string } emscriptenPath - The url path excluding the filename for the emscripten used by lib - quiet - js . @param { string } memoryInitializerPath - The url path excluding the filename for the memory file dynamically loaded by the emscripten . @param { number } transmissionDelay - The amount of time in milliseconds to wait between transmitting an ultrasound message . @returns { Promise } Resolves when the ultrasound library is ready to use .
initialize(
            emscriptenPath,
            memoryInitializerPath,
            transmissionDelay = 3000
    ) {
        if (this._initializationPromise) {
            return this._initializationPromise;
        }
        this._initializationPromise = loadDependencies({
            emscriptenPath,
            memoryInitializerPath
        })
        .then(() => {
            logger.log('ultrasound initialized successfully');
            this._isInitialized = true;
            this._transmissionDelay = transmissionDelay;
            if (this._text) {
                this.setMessage(this._text);
            }
        })
        .catch(error => {
            logger.error('ultrasound failed to initialize', { error });
            this._initializationPromise = null;
            return Promise.reject(error);
        });
        return this._initializationPromise;
    }
initialize ( emscriptenPath , memoryInitializerPath , transmissionDelay = 3000 ) { if ( this . _initializationPromise ) { return this . _initializationPromise ; } this . _initializationPromise = loadDependencies ( { emscriptenPath , memoryInitializerPath } ) . then ( ( ) => { logger . log ( 'ultrasound initialized successfully' ) ; this . _isInitialized = true ; this . _transmissionDelay = transmissionDelay ; if ( this . _text ) { this . setMessage ( this . _text ) ; } } ) . catch ( error => { logger . error ( 'ultrasound failed to initialize' , { error } ) ; this . _initializationPromise = null ; return Promise . reject ( error ) ; } ) ; return this . _initializationPromise ; }
Loads the external file dependencies for the ultrasound library.
Loads the external file dependencies for the ultrasound library .