public void clear() { for (String key : this) { $delete(key); } } }
/** * Writes contact data to localstorage. * * @memberOf EcIdentityManager * @method saveContacts * @static */ private static void saveContacts() { Array<Object> c = new Array<Object>(); for (int i = 0; i < contacts.$length(); i++) { Object o = new Object(); Map<String, Object> props = JSObjectAdapter.$properties(o); EcContact contact = contacts.$get(i); props.$put("displayName", contact.displayName); props.$put("pk", contact.pk.toPem()); props.$put("source", contact.source); c.push(o); } Global.localStorage.$put("contacts", JSGlobal.JSON.stringify(c)); }
Object localStore = Global.localStorage.$get("contacts"); if (localStore == null) { return;
/** * Writes contact data to localstorage. * * @memberOf EcIdentityManager * @method saveIdentities * @static */ public static void saveIdentities() { Array<Object> c = new Array<Object>(); for (int i = 0; i < ids.$length(); i++) { Object o = new Object(); Map<String, Object> props = JSObjectAdapter.$properties(o); EcIdentity identity = ids.$get(i); props.$put("displayName", identity.displayName); props.$put("ppk", identity.ppk.toPem()); props.$put("source", identity.source); c.push(o); } Global.localStorage.$put("identities", JSGlobal.JSON.stringify(c)); }
Object localStore = Global.localStorage.$get("identities"); if (localStore == null) { return;
/** * Clears contacts from the local storage * * @memberOf EcIdentityManager * @method clearContacts * @static */ public static void clearContacts() { Global.localStorage.$delete("contacts"); contacts = new Array<EcContact>(); }
/** * Clears identities from the local storage * * @memberOf EcIdentityManager * @method clearIdentities * @static */ public static void clearIdentities() { Global.localStorage.$delete("identities"); ids = new Array<EcIdentity>(); }