Skip to content

Instantly share code, notes, and snippets.

@erickzhao
Created June 12, 2019 18:20
Show Gist options
  • Save erickzhao/921b377a87e57ef85920d14efa2f0d43 to your computer and use it in GitHub Desktop.
Save erickzhao/921b377a87e57ef85920d14efa2f0d43 to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
<!-- Empty -->
const { app, session } = require('electron');
async function testCookies() {
const name = 'foo'
const url = "http://www.github.com"
const cookies = session.defaultSession.cookies
const cookie = {
url,
name,
value: 'Hello World!',
expirationDate: 99999999999999999999
}
await cookies.set(cookie)
// Query all cookies.
const addedRes = await cookies.get({})
console.log("Added", addedRes)
await cookies.remove(url, name)
const removedRes = await cookies.get({})
console.log("Removed", removedRes)
}
//....
app.on('ready', () => {
testCookies()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment