mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
clear() method added
This commit is contained in:
@@ -74,3 +74,8 @@ export var remove = function (key: string): void {
|
||||
editor.remove(key);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
export var clear = function (): void {
|
||||
ensureSharedPreferences();
|
||||
sharedPreferences.edit().clear().commit();
|
||||
}
|
||||
|
||||
@@ -55,4 +55,9 @@ declare module "application-settings" {
|
||||
* @param key The key to check for.
|
||||
*/
|
||||
export function remove(key: string): void;
|
||||
|
||||
/**
|
||||
* Removes all values.
|
||||
*/
|
||||
export function clear(): void;
|
||||
}
|
||||
@@ -59,3 +59,7 @@ export var remove = function (key: string): void {
|
||||
userDefaults.removeObjectForKey(key);
|
||||
userDefaults.synchronize();
|
||||
}
|
||||
|
||||
export var clear = function (): void {
|
||||
userDefaults.removePersistentDomainForName(NSBundle.mainBundle().bundleIdentifier);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user