Created
June 5, 2017 10:36
-
-
Save AamuLumi/ba4b927ce5d7f45f15fd9c0e1e399a30 to your computer and use it in GitHub Desktop.
Nightmare action to remove downloads in a Nightmare scenario
This file contains hidden or 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
Nightmare.action('removeDownload', | |
function(ns, options, parent, win, renderer, done) { | |
parent.respondTo('removeDownload', function(subDone) { | |
win.webContents.session.on('will-download', (event, item, webContents) => { | |
// Remove download event | |
event.preventDefault(); | |
}); | |
subDone(null); | |
}); | |
done(null); | |
}, | |
function(done) { | |
this.child.call('removeDownload', done); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment