Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
297 views
in Technique[技术] by (71.8m points)

javascript - 我应该只使用IndexedDB还是同时使用IndexedDB和chrome.storage?(Should I use only IndexedDB or both IndexedDB and chrome.storage?)

I'm a bit confused here.(我在这里有点困惑。)

I'm making a chrome extension where users can store data (like images and common extension options).(我正在制作一个chrome扩展程序,用户可以在其中存储数据(例如图像和常见的扩展程序选项)。) What I want to know is what is the best way to store the data?(我想知道什么是存储数据的最佳方法?)
  • Is it only IndexedDB, where both extension options and files can be stored there(仅仅是IndexedDB,扩展选项和文件都可以存储在那儿)
  • Or using both IndexedDB and chrome storage, where IndexedDB only stores the large files(或同时使用IndexedDB和chrome存储,其中IndexedDB仅存储大文件)

Thank you(谢谢)

  ask by SnekNOTSnake translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since chrome.storage can't store ArrayBuffer the most reasonable choice for files is IndexedDB.(由于chrome.storage无法存储ArrayBuffer ,因此文件的最合理选择是IndexedDB。)

The options, assuming it's a very small object , may be stored in chrome.storage.(这些选项(假设它是一个很小的对象 )可以存储在chrome.storage中。)

sync so the user gets the same options on every device or chrome.storage.(同步,以便用户在每个设备或chrome.storage上获得相同的选项。) local if syncing doesn't make sense for your extension or the object is big.(如果同步对您的扩展名没有意义或对象很大,则为本地 。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...