Module-documentation

version 1.0.0
module: client-storage
maintanance: Marco Asbreuk
home
all modules

Usage client-storage

This example shows how data can be stored using ClientStorage

Code-example:

<script src="itsabuild-min.js"></script>
<script>
    var storage = new ITSA.ClientStorage('my_storage'),
        savePromise;

    savePromise = storage.set('president1', {name: 'Barack', lastName: 'Obama', 'birth': 1961})

    // wait for saving to be finished before reading it
    savePromise.then(
        function() {
            storage.get('president1').then(
                function(president) {
                    ITSA.alert('found: '+president.name+' '+president.lastName);
                }
            ).catch(function(err) {ITSA.warn(err);});
        }
    ).catch(function(err) {ITSA.warn(err);})
    .finally(function() {
        // cleanup
        db.deleteStorage();
    });

</script>
API Docs