diff --git a/dist/types/audiokeys.d.ts b/dist/types/audiokeys.d.ts new file mode 100644 index 0000000..cbce07b --- /dev/null +++ b/dist/types/audiokeys.d.ts @@ -0,0 +1,26 @@ +type AudioKeysOptions = { + polyphony: number + rows: 1 | 2 + priority: 'last' | 'first' | 'highest' | 'lowest' + rootNote: number + octaveControls: boolean + velocityControls: boolean +} + +interface AudioKeysNoteData { + velocity: number // the velocity, between 0 and 127 + keyCode: number // the keyboard key pressed or released + note: number + frequency: number + isActive: boolean +} + +declare module 'audiokeys' { + export default class AudioKeysDefault { + constructor(options?: Partial) + up(callback: (note: AudioKeysNoteData) => void): void + down(callback: (note: AudioKeysNoteData) => void): void + clear: () => void + } + export class AudioKeys extends AudioKeysDefault {} +} diff --git a/package.json b/package.json index 5f910c5..4a9e640 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "type" : "git", "url" : "https://github.com/kylestetz/AudioKeys.git" }, + "types": "dist/types/audiokeys.d.ts", "keywords": [ "web audio", "audio", diff --git a/src/AudioKeys.js b/src/AudioKeys.js index 0cef530..349836c 100644 --- a/src/AudioKeys.js +++ b/src/AudioKeys.js @@ -63,4 +63,5 @@ AudioKeys.prototype._specialKeyMap = special._specialKeyMap; // Browserify will take care of making this a global // in a browser environment without a build system. -module.exports = AudioKeys; \ No newline at end of file +module.exports = AudioKeys; +module.exports.AudioKeys = AudioKeys;