Trigger function based on globalShortcut


#1

Hi Guys,

Wonderful project!

In my index.js file that runs node commands I have

globalShortcut.register('MediaPreviousTrack', function() { console.log('prev'); });

this logs into my terminal.

in my index.html file, I would like to detect this event and do some DOM manipulations.

How can I access this event from my index.html file?

Thank you,
Adrian


#2

I didn’t knew about the remote module that allows you to connect the two together.

This seems to do the work in HTML

var remote = require('remote');
var globalShortcut = remote.require('global-shortcut');

globalShortcut.register('MediaPreviousTrack', function() {
    console.log('MediaPreviousTrack');
});