mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
local-store - fix promisification of methods
This commit is contained in:
parent
9226de6c95
commit
481983aae8
@ -3,7 +3,6 @@
|
|||||||
// https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/local
|
// https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/local
|
||||||
|
|
||||||
const extension = require('extensionizer')
|
const extension = require('extensionizer')
|
||||||
const { promisify } = require('util')
|
|
||||||
|
|
||||||
module.exports = class ExtensionStore {
|
module.exports = class ExtensionStore {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -12,8 +11,8 @@ module.exports = class ExtensionStore {
|
|||||||
log.error('Storage local API not available.')
|
log.error('Storage local API not available.')
|
||||||
}
|
}
|
||||||
const local = extension.storage.local
|
const local = extension.storage.local
|
||||||
this._get = promisify(local.get).bind(local)
|
this._get = function() { return new Promise((resolve) => local.get(resolve)) }
|
||||||
this._set = promisify(local.set).bind(local)
|
this._set = function(state) { return new Promise((resolve) => local.set(state, resolve)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
async get() {
|
async get() {
|
||||||
|
Loading…
Reference in New Issue
Block a user