use await to avoid unnecessary throwing error messages
This commit is contained in:
parent
0a696ad54e
commit
ff318d464b
1 changed files with 3 additions and 11 deletions
|
@ -428,19 +428,11 @@ class session {
|
||||||
return DATABASE;
|
return DATABASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Forcibly write the data to chrome database
|
|
||||||
|
|
||||||
@param {object} DATA the data
|
|
||||||
*/
|
|
||||||
const store = async (DATA) => {
|
|
||||||
return(chrome.storage.session.set(DATA));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function verify (NAME, DATA) {
|
async function verify (NAME, DATA) {
|
||||||
let DATA_CHECK = {};
|
let DATA_CHECK = {};
|
||||||
|
|
||||||
// Verify the presence of the data.
|
// Verify the presence of the data.
|
||||||
DATA_CHECK[`state`] = await compare(null, [session.read([...NAME]), DATA]);
|
DATA_CHECK[`state`] = await compare(null, [await session.read([...NAME]), DATA]);
|
||||||
|
|
||||||
// Only notify when writing failed.
|
// Only notify when writing failed.
|
||||||
(!DATA_CHECK[`state`])
|
(!DATA_CHECK[`state`])
|
||||||
|
@ -462,8 +454,8 @@ class session {
|
||||||
DATA[`inject`] = nest(DATA[`all`], [...TARGET], DATA[`write`]);
|
DATA[`inject`] = nest(DATA[`all`], [...TARGET], DATA[`write`]);
|
||||||
|
|
||||||
// Write!
|
// Write!
|
||||||
store(DATA[`inject`]);
|
chrome.storage.session.set(DATA[`inject`]);
|
||||||
return(verify(TARGET, DATA[`write`]));
|
return(await verify(TARGET, DATA[`write`]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue