mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
This commit is contained in:
parent
8fbd6a0043
commit
7ae68c8d7d
@ -792,15 +792,21 @@ var restoreUserData = function(request) {
|
||||
vAPI.localStorage.removeItem('immediateHiddenSettings');
|
||||
};
|
||||
|
||||
// Remove all stored data but keep global counts, people can become
|
||||
// quite attached to numbers
|
||||
|
||||
var resetUserData = function() {
|
||||
vAPI.cacheStorage.clear();
|
||||
vAPI.storage.clear();
|
||||
let count = 3;
|
||||
let countdown = ( ) => {
|
||||
count -= 1;
|
||||
if ( count === 0 ) {
|
||||
vAPI.app.restart();
|
||||
}
|
||||
};
|
||||
vAPI.cacheStorage.clear(countdown); // 1
|
||||
vAPI.storage.clear(countdown); // 2
|
||||
µb.saveLocalSettings(countdown); // 3
|
||||
vAPI.localStorage.removeItem('immediateHiddenSettings');
|
||||
|
||||
// Keep global counts, people can become quite attached to numbers
|
||||
µb.saveLocalSettings();
|
||||
|
||||
vAPI.app.restart();
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2018 Raymond Hill
|
||||
Copyright (C) 2014-present Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -52,17 +52,17 @@
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.saveLocalSettings = (function() {
|
||||
var saveAfter = 4 * 60 * 1000;
|
||||
let saveAfter = 4 * 60 * 1000;
|
||||
|
||||
var save = function() {
|
||||
let save = function(callback) {
|
||||
this.localSettingsLastSaved = Date.now();
|
||||
vAPI.storage.set(this.localSettings);
|
||||
vAPI.storage.set(this.localSettings, callback);
|
||||
};
|
||||
|
||||
var onTimeout = function() {
|
||||
var µb = µBlock;
|
||||
let onTimeout = ( ) => {
|
||||
let µb = µBlock;
|
||||
if ( µb.localSettingsLastModified > µb.localSettingsLastSaved ) {
|
||||
save.call(µb);
|
||||
µb.saveLocalSettings();
|
||||
}
|
||||
vAPI.setTimeout(onTimeout, saveAfter);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user