mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Rewrite 'Preferences' to make it async
This commit is contained in:
parent
bd11111465
commit
c920372ff2
3 changed files with 173 additions and 92 deletions
|
@ -104,15 +104,17 @@ var DownloadManager = (function DownloadManagerClosure() {
|
|||
return DownloadManager;
|
||||
})();
|
||||
|
||||
Preferences.prototype.writeToStorage = function(prefObj) {
|
||||
FirefoxCom.requestSync('setPreferences', prefObj);
|
||||
Preferences._writeToStorage = function (prefObj) {
|
||||
return new Promise(function (resolve) {
|
||||
FirefoxCom.requestSync('setPreferences', prefObj);
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
Preferences.prototype.readFromStorage = function(prefObj) {
|
||||
var readFromStoragePromise = new Promise(function (resolve) {
|
||||
Preferences._readFromStorage = function (prefObj) {
|
||||
return new Promise(function (resolve) {
|
||||
var readPrefs = JSON.parse(FirefoxCom.requestSync('getPreferences',
|
||||
prefObj));
|
||||
resolve(readPrefs);
|
||||
});
|
||||
return readFromStoragePromise;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue