Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Strip leading slashes before matching event name
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Sep 13, 2024
1 parent 844c33a commit d97c5ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/preload/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { ipcRenderer } from 'electron'
export default {
on: (event, callback) => {
ipcRenderer.on('native-event', (_, data) => {
if(event !== data.event) {
return;
}

callback(data.payload);
// Strip leading slashes
event = event.replace(/^(\\)+/, '');
data.event = data.event.replace(/^(\\)+/, '');

if(event === data.event) {
return callback(data.payload);
}
})
}
}

0 comments on commit d97c5ee

Please sign in to comment.