From d27c2a77a9f1c66a4560c0f140622ae9ef8a1a96 Mon Sep 17 00:00:00 2001 From: Sema Date: Sat, 11 May 2024 22:38:00 -0400 Subject: [PATCH] try/catch block --- test/engine3.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/engine3.js b/test/engine3.js index d8de1c8..cac8f05 100644 --- a/test/engine3.js +++ b/test/engine3.js @@ -6,10 +6,12 @@ global.performance = { now: function() { return Date.now() - _startTime; } }; var WMT = require('web-midi-test'); WMT.sysex = false; -if (navigator) { // node 22 has a navigator object +try { navigator.requestMIDIAccess = WMT.requestMIDIAccess; } -else global.navigator = WMT; +catch (e) { + global.navigator = WMT; +} var JZZ = require('..');