Commit ef858e53 authored by mercury233's avatar mercury233

add button: clear cache

parent 2d0aa9d1
Pipeline #17150 failed with stages
in 3 minutes and 17 seconds
......@@ -78,6 +78,8 @@
</div>
</div>
<div class="modal-footer">
<button i18n type="button" class="btn btn-danger" style="margin-right: auto" (click)="clear_cache()"
data-toggle="tooltip" i18n-title title="清除MyCard的缓存,并重启MyCard">清除缓存</button>
<button i18n type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n type="submit" class="btn btn-primary">确定</button>
</div>
......
......@@ -66,6 +66,9 @@ export class MyCardComponent implements OnInit {
this.currentWindow.webContents.openDevTools({ mode: 'undocked' });
}
});
//$('[data-toggle="tooltip"]').tooltip();
// bootstrap有BUG不能用这玩意
// document.addEventListener('drop', (event)=>{
// console.log('drop', event);
// event.preventDefault();
......@@ -133,6 +136,28 @@ export class MyCardComponent implements OnInit {
shell.openExternal(url);
}
clear_cache() {
// 删除下载中的文件可能会出问题 先不搞
// 需要 import * as fs from 'fs-extra';
/*let downloadingDirPath = path.join(this.settingsService.getDefaultLibrary().path, 'downloading');
console.log('removing downloading dir', downloadingDirPath);
fs.remove(downloadingDirPath, (error: any) => {
if (error) { console.error(error); }
remote.getCurrentWebContents().session.clearCache((error: any) => {
if (error) { console.error(error); }
console.log('cache cleared', error);
remote.app.relaunch();
remote.app.quit();
});
});*/
remote.getCurrentWebContents().session.clearCache((error: any) => {
if (error) { console.error(error); }
console.log('cache cleared', error);
remote.app.relaunch();
remote.app.quit();
});
}
submit() {
if (this.locale !== this.settingsService.getLocale()) {
localStorage.setItem(SettingsService.SETTING_LOCALE, this.locale);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment