Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Philippe Côté committed Sep 15, 2023
2 parents c8e2017 + 9757059 commit aa979a2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/electron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,25 @@ A collection of examples to use WEBMIDI.js inside an Electron application.
## Examples

* [**Basic Electron Example**](basic-example)

## Platform specific notes

The permission requests must be properly handled in the main process before initializing WEBMIDI:

```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;
});
```

0 comments on commit aa979a2

Please sign in to comment.