-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implementation details for Electron
- Loading branch information
Jean-Philippe Côté
committed
Sep 15, 2023
1 parent
163bd7c
commit c8e2017
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
sidebar_position: 5 | ||
title: Electron | ||
--- | ||
|
||
# Electron | ||
|
||
WEBMIDI.js works fine inside [Electron](https://www.electronjs.org/) but you must make sure to | ||
properly handle the permission request and permission check handlers from within the main process: | ||
|
||
```javascript | ||
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, callback, details) => { | ||
if (permission === 'midi' || permission === 'midiSysex') { | ||
callback(true); | ||
} else { | ||
callback(false); | ||
} | ||
}) | ||
|
||
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin) => { | ||
if (permission === 'midi' || permission === 'midiSysex') { | ||
return true; | ||
} | ||
return false; | ||
}); | ||
``` |