mirror of https://github.com/gorhill/uBlock.git
Use getItemAsync() instead of getItem
Related commit:
- da0ef9454a
vAPI.localStorage.getItemAsync() was added after
the above commit.
This commit is contained in:
parent
44dfb8fbad
commit
953e0c3197
|
@ -1446,12 +1446,9 @@ vAPI.cloud = (( ) => {
|
||||||
deviceName: undefined,
|
deviceName: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDeviceName = function() {
|
vAPI.localStorage.getItemAsync('deviceName').then(value => {
|
||||||
if ( options.deviceName === undefined ) {
|
options.deviceName = value;
|
||||||
options.deviceName = vAPI.localStorage.getItem('deviceName') || '';
|
});
|
||||||
}
|
|
||||||
return options.deviceName;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is used to find out a rough count of how many chunks exists:
|
// This is used to find out a rough count of how many chunks exists:
|
||||||
// We "poll" at specific index in order to get a rough idea of how
|
// We "poll" at specific index in order to get a rough idea of how
|
||||||
|
@ -1499,7 +1496,7 @@ vAPI.cloud = (( ) => {
|
||||||
|
|
||||||
const push = async function(dataKey, data) {
|
const push = async function(dataKey, data) {
|
||||||
let bin = {
|
let bin = {
|
||||||
'source': getDeviceName() || options.defaultDeviceName,
|
'source': options.deviceName || options.defaultDeviceName,
|
||||||
'tstamp': Date.now(),
|
'tstamp': Date.now(),
|
||||||
'data': data,
|
'data': data,
|
||||||
'size': 0
|
'size': 0
|
||||||
|
@ -1585,7 +1582,6 @@ vAPI.cloud = (( ) => {
|
||||||
|
|
||||||
const getOptions = function(callback) {
|
const getOptions = function(callback) {
|
||||||
if ( typeof callback !== 'function' ) { return; }
|
if ( typeof callback !== 'function' ) { return; }
|
||||||
getDeviceName();
|
|
||||||
callback(options);
|
callback(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue