如何在chromeapp中使用unlimitedStorage? [英] How to use unlimitedStorage in chromeapp?

查看:110
本文介绍了如何在chromeapp中使用unlimitedStorage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者,正在尝试制作Chrome应用.我的chrome应用程序有持续的需求,因此将使用索引数据库.另外,我希望该应用具有无限制的存储空间.

我正在使用

  chrome.storage.syncchrome.storage.local 

设置和获取值.

在清单文件中,当我使用"unlimitedStorage"时,出现一条错误消息,指出sync,local是未定义的.

但是,在清单文件中,如果我使用存储",则不会出现任何错误.

任何人都可以让我知道该怎么做吗?

解决方案

存储" 是一项允许您访问 chrome.storage API的权限.

"unlimitedStorage" 删除了在用户磁盘( chrome.storage.local 或IndexedDB)上本地存储数据的存储API的最大大小限制.这样就不可能增加 chrome.storage.sync 的配额,因为它会将数据存储在云中的某个地方.

因此,如果您想取消 chrome.storage.local 的配额,则必须同时具有"storage" "unlimitedStorage" 权限.

I am a beginner and trying to make a chrome app. My chrome app has persistent needs and will therefore use an indexed db. Also, I want the app to have unlimitedStorage.

I am using

chrome.storage.sync
chrome.storage.local

to set and get values.

In my manifest file, when I use "unlimitedStorage" I get an error saying that sync ,local is undefined.

But, in my manifest file, if I use "storage" i don't get any errors.

Can anyone let me know how to do this?

解决方案

"storage" is a permission which give you access to the chrome.storage APIs.

"unlimitedStorage" removes maximum size limits from storage APIs that are storing data locally, on user disk (chrome.storage.local or IndexedDB). It is impossible to increase the quota for chrome.storage.sync that way, since it stores data somewhere in the cloud.

So if you want to lift quota for chrome.storage.local, you'll have to have both "storage" and "unlimitedStorage" permissions.

这篇关于如何在chromeapp中使用unlimitedStorage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆