有没有办法在这样的调用后检查本地存储限制是否超出:
amplify.store("key", object);
如果我尝试存储大于本地存储限制的内容会怎样?
是的,它会抛出“amplify.store quota exceeded”,如您在此处看到的
store.error = function() {
return "amplify.store quota exceeded";
};
...
try {
storage.setItem( key, parsed );
// quota exceeded
} catch( error ) {
// expire old data and try again
store[ storageType ]();
try {
storage.setItem( key, parsed );
} catch( error ) {
throw store.error();
}
}