Skip to content

Instantly share code, notes, and snippets.

View andrei0x309's full-sized avatar

Andrei O. andrei0x309

View GitHub Profile
@sumitpore
sumitpore / chrome-local-storage-api.js
Last active February 9, 2024 05:19
Chrome's Local StorageArea API in Synchronous way for use in Chrome extensions. Replace 'chrome.storage.local' by 'chrome.storage.sync' if you want to use Sync StorageArea
/**
* Retrieve object from Chrome's Local StorageArea
* @param {string} key
*/
const getObjectFromLocalStorage = async function(key) {
return new Promise((resolve, reject) => {
try {
chrome.storage.local.get(key, function(value) {
resolve(value[key]);
});