mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Refactors history and how the database is stored
This commit is contained in:
parent
9c59437ac3
commit
b39f0c311c
7 changed files with 37 additions and 55 deletions
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals DEFAULT_PREFERENCES, isLocalStorageEnabled, Promise */
|
||||
/* globals DEFAULT_PREFERENCES, Promise */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -174,19 +174,14 @@ var Preferences = {
|
|||
//#if !(FIREFOX || MOZCENTRAL || B2G)
|
||||
Preferences._writeToStorage = function (prefObj) {
|
||||
return new Promise(function (resolve) {
|
||||
if (isLocalStorageEnabled) {
|
||||
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
||||
}
|
||||
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
Preferences._readFromStorage = function (prefObj) {
|
||||
return new Promise(function (resolve) {
|
||||
var readPrefs;
|
||||
if (isLocalStorageEnabled) {
|
||||
readPrefs = JSON.parse(localStorage.getItem('pdfjs.preferences'));
|
||||
}
|
||||
var readPrefs = JSON.parse(localStorage.getItem('pdfjs.preferences'));
|
||||
resolve(readPrefs);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue