All files / src/web audio-utils.js

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12              22x 3x 2x    
/**
 * Create an AudioContext with a fallback for older WebKit browsers.
 * @param {AudioContextOptions} [options] - passed to the AudioContext constructor
 * @returns {AudioContext|null}
 */
export function createAudioContext(options) {
    /*global webkitAudioContext*/
    if (typeof AudioContext !== "undefined") return new AudioContext(options);
    if (typeof webkitAudioContext !== "undefined") return new webkitAudioContext(options);
    return null;
}