mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32: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) {
|
this.setItem = function(key, val) {
|
||||||
console.log('set');
|
//console.log('set');
|
||||||
storage[key] = val;
|
storage[key] = val;
|
||||||
|
|
||||||
this.db.transaction(
|
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) {
|
} catch(e) {
|
||||||
alert("Database error "+e+".");
|
alert("Database error "+e+".");
|
||||||
|
Loading…
Reference in New Issue
Block a user