๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘จ๐Ÿผ‍๐Ÿ’ป๊ฐœ๋ฐœ

ํฌ๋กฌ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ - chrome storage ์กฐ์ž‘

by Janger 2022. 2. 20.
728x90
๋ฐ˜์‘ํ˜•

1) ๊ถŒํ•œ ์„ค์ •

"permissions": ["storage"]

 

2) ๋ฐ์ดํ„ฐ ์ง€์ •

chrome.storage.sync.set({ userData: user });

 

3) ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ

chrome.storage.sync.get(["userData"], result => {});

 

 

 

์‚ฌ์šฉ ์˜ˆ์‹œ) 

async function loadSecNvMids(){
    return new Promise( (resolve, reject)=>{
        chrome.storage.sync.get(["secNvMids"], result => {
            resolve( result );
        });
    } )
}

async function main(){
    var secNvMids = null;

    secNvMids = await loadSecNvMids();
    secNvMids = secNvMids.secNvMids;

};

 

 

background js์—์„œ๋„ chrome.storage๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ์Œ

 

์ถœ์ฒ˜: 

https://13akstjq.github.io/chrome-extension/2019/07/22/chrome-extension%EC%97%90-%EB%93%B1%EB%A1%9D%ED%95%98%EA%B8%B0.html

 

์›น ๊ฐœ๋ฐœ ๊ธฐ์ˆ  ๋ธ”๋กœ๊ทธ

์›น ๊ฐœ๋ฐœ์— ํ•„์š”ํ•œ ์ง€์‹์„ ๊ธฐ๋กํ•˜๋Š” ๋ธ”๋กœ๊ทธ์ž…๋‹ˆ๋‹ค.

13akstjq.github.io

https://gist.github.com/sumitpore/47439fcd86696a71bf083ede8bbd5466

 

Chrome's Local StorageArea API in Synchronous way for use in Chrome extensions. Replace 'chrome.storage.local' by 'chrome.storag

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 - chr...

gist.github.com

 

728x90
๋ฐ˜์‘ํ˜•