Skip to content

⬅️ Back to Table of Contents

📄 AudioContext.js

📊 Analysis Summary

Metric Count
🔧 Functions 2
🧱 Classes 1
📊 Variables & Constants 1

📚 Table of Contents

🛠️ File Location:

📂 src/audio/AudioContext.js

Variables & Constants

Name Type Kind Value Exported
_context any let/var *not shown*

Functions

AudioContext.getContext(): AudioContext

JSDoc:

/**
     * Returns the global native audio context.
     *
     * @return {AudioContext} The native audio context.
     */

Returns: AudioContext

Code
static getContext() {

        if ( _context === undefined ) {

            _context = new ( window.AudioContext || window.webkitAudioContext )();

        }

        return _context;

    }

AudioContext.setContext(value: AudioContext): void

JSDoc:

/**
     * Allows to set the global native audio context from outside.
     *
     * @param {AudioContext} value - The native context to set.
     */

Parameters:

  • value AudioContext

Returns: void

Code
static setContext( value ) {

        _context = value;

    }

Classes

AudioContext

Class Code
class AudioContext {

    /**
     * Returns the global native audio context.
     *
     * @return {AudioContext} The native audio context.
     */
    static getContext() {

        if ( _context === undefined ) {

            _context = new ( window.AudioContext || window.webkitAudioContext )();

        }

        return _context;

    }

    /**
     * Allows to set the global native audio context from outside.
     *
     * @param {AudioContext} value - The native context to set.
     */
    static setContext( value ) {

        _context = value;

    }

}

Methods

getContext(): AudioContext
Code
static getContext() {

        if ( _context === undefined ) {

            _context = new ( window.AudioContext || window.webkitAudioContext )();

        }

        return _context;

    }
setContext(value: AudioContext): void
Code
static setContext( value ) {

        _context = value;

    }