fix pattern checks for minified code
This commit is contained in:
parent
ef75590853
commit
9458faf5b0
7 changed files with 1359 additions and 22 deletions
|
|
@ -1,13 +1,11 @@
|
|||
import { isNote } from 'tone';
|
||||
import _WebMidi from 'webmidi';
|
||||
import { Pattern as _Pattern } from '@strudel/core/strudel.mjs';
|
||||
import { Pattern, isPattern } from '@strudel/core/strudel.mjs';
|
||||
import { Tone } from '@strudel/tone';
|
||||
|
||||
// if you use WebMidi from outside of this package, make sure to import that instance:
|
||||
export const WebMidi = _WebMidi;
|
||||
|
||||
const Pattern = _Pattern;
|
||||
|
||||
export function enableWebMidi() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (WebMidi.enabled) {
|
||||
|
|
@ -28,7 +26,7 @@ const outputByName = (name) => WebMidi.getOutputByName(name);
|
|||
|
||||
// Pattern.prototype.midi = function (output: string | number, channel = 1) {
|
||||
Pattern.prototype.midi = function (output, channel = 1) {
|
||||
if (output?.constructor?.name === 'Pattern') {
|
||||
if (isPattern(output?.constructor?.name)) {
|
||||
throw new Error(
|
||||
`.midi does not accept Pattern input. Make sure to pass device name with single quotes. Example: .midi('${
|
||||
WebMidi.outputs?.[0]?.name || 'IAC Driver Bus 1'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue