Skip to content

Instantly share code, notes, and snippets.

@erickzhao
Created June 12, 2019 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erickzhao/d8ae35040d44d426cb40d97d5d77a47e to your computer and use it in GitHub Desktop.
Save erickzhao/d8ae35040d44d426cb40d97d5d77a47e 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 = "/"
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