storage.local

webix.storage.local

webix.storage.local helper.

Please look into the linked official documentation.

Referenced by

helpers
offline.

External references

Official documentation page.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
webix.storage.local = {
    put:function(name, data){
        if(name && window.JSON && window.localStorage){
            window.localStorage.setItem(name, window.JSON.stringify(data));
        }
    },
    get:function(name){
        if(name && window.JSON && window.localStorage){
            var json = window.localStorage.getItem(name);
            if(!json)
                return null;
            return webix.DataDriver.json.toObject(json);
        }else
            return null;
    },
    remove:function(name){
        if(name && window.JSON && window.localStorage){
            window.localStorage.removeItem(name);
        }
    },
    clear:function(){
        window.localStorage.clear();
    }
};