Call Storage API with callback?
Chrome has an option to provide a callback when using .set(), wondering if the same is possible with Plasmo's Storage API?
chrome.storage.sync.set({ products: aoProduct }, function () { console.log( "Added product ", oProduct, "to Chrome storage. New products: ", aoProduct ) resolve() })
chrome.storage.sync.set({ products: aoProduct }, function () { console.log( "Added product ", oProduct, "to Chrome storage. New products: ", aoProduct ) resolve() })
5 Replies
I can work around it in this example, just wondering
the storage API is async by nature
if you need callback, use
.then
but I would use async for these casesOk cool makes sense just checking thx @louisgv !
Gave +1 Rep to @louisgv
@hgil has reached level 2. GG!