Skip to content

Instantly share code, notes, and snippets.

@dcposch
Created June 13, 2016 23:20
Show Gist options
  • Save dcposch/1e546279f162de7d644b224058b27fb0 to your computer and use it in GitHub Desktop.
Save dcposch/1e546279f162de7d644b224058b27fb0 to your computer and use it in GitHub Desktop.
// In the main process, check whether the app is starting
// because the user dragged files onto the app icon
process.argv.forEach(onOpen)
// Open handlers should be added on the first tick.
// These fire if the app is already running and the user
// drags files or URLs onto the dock icon, or if they set
// the app as a handler for a file type and then open a file
app.on('open-file', onOpen)
app.on('open-url', onOpen)
// Separately, in the renderer process, you can use the HTML5
// drag-drop API to create a drop target and handle files
// dropped directly onto the window.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment