mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Refactor the Preferences
classes to utilize async
methods rather than manually returning Promise
s
This commit is contained in:
parent
64e70fc16f
commit
233b3274bf
4 changed files with 53 additions and 61 deletions
|
@ -26,18 +26,12 @@ if (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('GENERIC')) {
|
|||
let GenericCom = {};
|
||||
|
||||
class GenericPreferences extends BasePreferences {
|
||||
_writeToStorage(prefObj) {
|
||||
return new Promise(function(resolve) {
|
||||
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
||||
resolve();
|
||||
});
|
||||
async _writeToStorage(prefObj) {
|
||||
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
||||
}
|
||||
|
||||
_readFromStorage(prefObj) {
|
||||
return new Promise(function(resolve) {
|
||||
let readPrefs = JSON.parse(localStorage.getItem('pdfjs.preferences'));
|
||||
resolve(readPrefs);
|
||||
});
|
||||
async _readFromStorage(prefObj) {
|
||||
return JSON.parse(localStorage.getItem('pdfjs.preferences'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue