requestMIDIAccess for all
JavaScript
Latest commit d0cc89e Jul 18, 2016 @mohayonao 1.0.0
Permalink
Failed to load latest commit information.
.eslintrc init Jul 14, 2016
.gitignore init Jul 14, 2016
.travis.yml init Jul 14, 2016
README.md
index.js
package.json 1.0.0 Jul 18, 2016
test.js update web-midi-test-api Jul 15, 2016

README.md

request-midi-access

Build Status NPM Version License

requestMIDIAccess for all

Installation

npm install --save request-midi-access

or copy and paste

function requestMIDIAccess(opts) {
  opts = opts || {};
  if (window.navigator && typeof window.navigator.requestMIDIAccess === "function") {
    return window.navigator.requestMIDIAccess(opts);
  }
  return Promise.reject(new TypeError("Web MIDI API is not supported"));
}

How to use

const requestMIDIAccess = require("request-midi-access");

requestMIDIAccess().then((access) => {
  // Web MIDI API is supported
}, (e) => {
  console.log(e);
  // → TypeError "Web MIDI API is not supported"
});

License

MIT