我正在app.js
中创建一个cookie/// cookies test
const session = require('electron').session;
const ses = session.fromPartition('persist:name');
debugger;
// Query all cookies associated with a specific url.
ses.cookies.get({}, (error, cookies) => {
debugger;
console.log(cookies); /// cookies values should be printed next time the applciation is launched.
});
// Set a cookie with the given cookie data;
// may overwrite equivalent cookies if they exist.
const cookie = {
url: 'http://www.github.com',
name: 'dummy_name',
value: 'dummy',
expirationDate: 2093792393999
};
ses.cookies.set(cookie, (error) => {
debugger;
if (error)
console.error(error);
ses.cookies.get({}, (error, cookies) => {
console.log(cookies); /// cookies values should be printed next time the applciation is launched.
});
});
我需要将cookie的数据访问到渲染过程中。怎么做?