Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To save the local variables throughout your application, AMM uses Local Storage. Examples used in AMM are displayed below. These variables are editable and can be configured to meet your organization's requirements.


Local Storage Declaration:

...

 

No Format
nopaneltrue
 var Storage = { 
 UserID: "UserID",

...

 
 LinkID: "LinkID",

...

 
 DisplayName: "DisplayName",

...

 
 TokenID: "TokenID",

...

 
 UserName: "UserName",

...

 
 UserPassword: "UserPassword",

...

 
 RememberMe: "RememberMe",

...

 
 FavEvent: "FavEvent",

...

 
 FavSession: "FavSession",

...

 
 ActiveFeed: "ActiveFeed",

...

 
 ResultPerPage: "ResultPerPage",

...

 
 EventsPastYearCount: "EventsPastYearCount"

...

 
 };

 

 

Note
titleNote

...

 This should be mainly declared

...

in the aptify.mobile.settings.js

...

 file

 

Creating Local Storage Variables

...


The below following is a generic method used to create Local Storage:

...

 

No Format
nopaneltrue
 function CreateLocalStorage(key, value) {

...

 
 if (typeof (localStorage) == 'undefined') {

...

 
 alert(ErrorMessages.LocalStorageSupport);

...

 
 } 
 else { 
 try { 
 localStorage[storageAppKey + key] = value;

...

 
 } 
 catch (e) {

...

 
 if (e == QUOTA_EXCEEDED_ERR) {

...

 
 alert(ErrorMessages.LocalStorageQuotaExeed);

...

 
 } 
 } 
 } 
 } 
 The given code is to create the Local Storage by calling the above method. 
 e.g. key= Storage.EventsPastYearCount and value="1"

...

 
 CreateLocalStorage(Storage.EventsPastYearCount, 1);

 

 

The generic method given below is used to read the Local Storage:

...

 

No Format
nopaneltrue
 function ReadLocalStorage(key) {

...

 
 if (localStorage == undefined) {

...

 
 alert(ErrorMessages.LocalStorageSupport);

...

 
 return false;

...

 
 } 
 else { 
 return $.trim(localStorage[storageAppKey + key]);

...

 
 } 
 }

 

For example, ReadLocalStorage(Storage.EventsPastYearCount)


The generic method below is used to delete the Local Storage:

 

No Format
function DeleteLocalStorage(key) {

...

 
 delete localStorage[storageAppKey + key];

...

 
 } 
 The given code is to delete the Local Storage by calling the above method. 
 e.g.

...

 
 DeleteLocalStorage (Storage.EventsPastYearCount)

 

 

Application Key

An Application key is mainly used to differentiate between two applications running on the same domain.

Application Key: var storageAppKey = "AMM";

  Note:

Note
titleNote

  This should be mainly declared

...

in the aptify.mobile.settings.js

...

 file