Android 使用$localfough.setItem时,应用程序会冻结几秒钟
我正在使用$localfough.setItem在ionic移动应用程序中本地存储数据。数据约为7MB,使用setItem时应用程序会冻结几秒钟Android 使用$localfough.setItem时,应用程序会冻结几秒钟,android,ios,angularjs,ionic-framework,localforage,Android,Ios,Angularjs,Ionic Framework,Localforage,我正在使用$localfough.setItem在ionic移动应用程序中本地存储数据。数据约为7MB,使用setItem时应用程序会冻结几秒钟 有什么建议可以解决这个问题吗?您可以利用承诺让应用程序在提取数据时保持运行 localforage.getItem("sellerName").then(function(sellerName) { // .... Any code that DEPENDS ON THIS DATA goes here. // TH
有什么建议可以解决这个问题吗?您可以利用承诺让应用程序在提取数据时保持运行
localforage.getItem("sellerName").then(function(sellerName) {
// .... Any code that DEPENDS ON THIS DATA goes here.
// THIS code will have a pause prefacing it, but code
// outside of this funtion will continue to process.
});
希望这对你有帮助!如果您的数据依赖于正在检索的数据,则可能需要更快地检索(如缓存数据)或在屏幕上临时放置加载程序映像。祝你好运
附录:你可以试试这个,我用它来获取“大数据”并获取多个大数据结果
var getLogs = $.ajax({ type: 'GET', url: 'testget.php?more=1' });
$('#results').html('Loading...');
$.when(getLogs).then( function(getLogs) {
$('#results').html(getLogs);
}, handleError);
function handleError(xhr, status, error) {
console.log("There was an Error: " + error.toString());
}
这应该能解决你的问题^5有人问我关于设置项目的问题,我有类似的问题,即使使用promise回调。