Hybrid View
-
2 Jun 2011 1:06 PM #1
Directly loading invalid LocalStorage record throws an exception
Directly loading invalid LocalStorage record throws an exception
Directly loading an invalid LocalStorage record throws an exception instead of calling provided failure callback.
I am attempting to check if a record is in local storage on startup using something like the following test case. Instead of calling the failure callback an error is being thrown.
WebStorage.js:201
Uncaught TypeError: Cannot read property 'id' of null
Code:Ext.define('User', { extend: 'Ext.data.Model', fields: ['id', 'name'], proxy: { type: 'localstorage', id: 'user' } }); Ext.onReady(function() { var User = Ext.ModelManager.getModel('User'); User.load(1, { success: function(user) { console.dir(user); }, failure: function() { console.log('Failure'); } }); });
-
15 Mar 2012 11:09 PM #2
Here’s how you can detect localStorage support:
// Feature test
var hasStorage = (function() {
try {
localStorage.setItem(mod, mod);
localStorage.removeItem(mod);
return true;
} catch(e) {
return false;
}
}());
anuncios clasificados
*LIFE'S SHORT. If you don't look around once in a while you might miss it*
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote