mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Added CupcakeLocalStorage.clear() method (in according to http://dev.w3.org/html5/webstorage/#the-storage-interface)
This commit is contained in:
parent
691b093ccd
commit
5e858f8bc3
@ -318,7 +318,7 @@ var CupcakeLocalStorage = function() {
|
||||
}
|
||||
);
|
||||
this.setItem = function(key, val) {
|
||||
console.log('set');
|
||||
//console.log('set');
|
||||
storage[key] = val;
|
||||
|
||||
this.db.transaction(
|
||||
@ -343,6 +343,16 @@ var CupcakeLocalStorage = function() {
|
||||
);
|
||||
|
||||
}
|
||||
this.clear = function() {
|
||||
storage = {};
|
||||
this.db.transaction(
|
||||
function (transaction) {
|
||||
transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
|
||||
|
||||
transaction.executeSql('DELETE FROM storage', []);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
} catch(e) {
|
||||
alert("Database error "+e+".");
|
||||
|
Loading…
Reference in New Issue
Block a user