我正在使用下面给出的代码创建cookie:
///Cookie
let cookie = {
url: 'http://www.example.com',
name: 'oauthDetailsGoogle',
value: JSON.stringify(oauthDetailsGoogle),
expirationDate: oauthDetailsGoogle.accessTokenExpireDateTime
};
///save cookie
electronConstants().mySession.cookies.set(cookie, (error) => {
///if error then return error
if (error) {
defer.reject(error);
}
///return null if no error
else {
defer.resolve(true);
}
});
Run Code Online (Sandbox Code Playgroud)
为了删除cookie我使用以下代码:
electronConstants().mySession.cookies.remove('http://www.example.com', 'oauthDetailsGoogle', function (data) {
console.log(data);
});
Run Code Online (Sandbox Code Playgroud)
假设我已经创建了10个厨师,为了删除10个厨师,我将不得不用具体细节10次调用删除功能?
请指导..非常感谢
Vik*_*sal 10
最后,我在Electron Documentation:Source中找到了一个解决方案
这是一次性清除所有内容的功能:
electronConstants().mySession.clearStorageData([], function (data) {
console.log(data);
})
Run Code Online (Sandbox Code Playgroud)
第一个参数需要options您可以自定义要清除的内容.请参阅我上面提供的文档链接.
非常感谢.
| 归档时间: |
|
| 查看次数: |
6656 次 |
| 最近记录: |