newyork-anthonyng/react-tone

View on GitHub
src/createAudioContext.js

Summary

Maintainability
A
0 mins
Test Coverage
/* istanbul ignore next */
const createAudioContext = () => {
  if (typeof window === "undefined") {
    return undefined;
  }

  const AudioContext = window.AudioContext || window.webkitAudioContext;
  if (AudioContext) return new AudioContext();

  return undefined;
};

export default createAudioContext;