本文介绍了有什么细节可以从webkitStorageInfo.queryUsageAndQuota()获得的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
webkitStorageInfo.queryUsageAndQuota()用于查找使用HTML5文件系统API存储在文件系统中的文件的使用情况统计信息。任何人都可以给我提供给此函数的回调中可以获得的细节。
使用控制台替换 function(){...} .log.bind(console),你会发现。> window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT,console.log.bind(console))
undefined //返回值^
0 0 //打印结果,参数0和参数1
回调的解释发现:
interface StorageInfo {
....
//查询当前配额以及为主机存储多少数据。
void queryUsageAndQuota(
unsigned short storageType,
可选StorageInfoUsageCallback successCallback,
可选StorageInfoErrorCallback errorCallback);
...
[NoInterfaceObject,Callback = FunctionOnly]
接口StorageInfoUsageCallback {
void handleEvent( unsigned long long currentUsageInBytes ,
unsigned long long currentQuotaInBytes );
};因此,第一个数字表示使用了多少个字节,
第二个数字显示了配额的大小。webkitStorageInfo.queryUsageAndQuota() is used to find out the usage stats of the files that have been stored in the file system using the HTML5 file system API I suppose. Can anyone give me the details that can be obtained in the callback provided to this function.
window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT, function() { //what all details can be obtained in this function as its arguments? })解决方案Replace function(){...} with console.log.bind(console), and you will find out.
> window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT, console.log.bind(console)) undefined // Return value of ^ 0 0 // Printed results, argument 0 and argument 1The explanation of the callback is found here:
interface StorageInfo { .... // Queries the current quota and how much data is stored for the host. void queryUsageAndQuota( unsigned short storageType, optional StorageInfoUsageCallback successCallback, optional StorageInfoErrorCallback errorCallback); ...[NoInterfaceObject, Callback=FunctionOnly] interface StorageInfoUsageCallback { void handleEvent(unsigned long long currentUsageInBytes, unsigned long long currentQuotaInBytes); };So, the first number indicates how many bytes are used,
the second number shows the quota's size.这篇关于有什么细节可以从webkitStorageInfo.queryUsageAndQuota()获得的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!