Skip to content

About

A persistent Javascript Object - Wrapper for localStorage to add full dot support

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

DotStorage

Wrapper for localStorage to add full dot support

jsFiddle for Testing

Dependencies

This requires pako to work...

Usage

Set primitive values:

dotStorage.Hello = "World";

Set objects:

dotStorage.simpleObj = {
    "Hello": "World"
};

Set complex arrays and access them again:

dotStorage.complexArray = [
    {"Hello": "World0", "index": 0},
    {"Hello": "World1", "index": 1},
    {"Hello": "World2", "index": 2}
];

dotStorage.complexArray.forEach(function (e, i) {
    console.log(e.Hello, e.index);
});

Save an object, modify nested properties and be surprised that DotStorage saves these changes too

var myObj = {"New": "object"};
dotStorage.refTest = myObj;
myObj = dotStorage.refTest;

myObj.New = {"nested": {"otherObject": [0, 1]}};
console.log(JSON.stringify(dotStorage.refTest.New));

myObj.New.nested = 2;
console.log(JSON.stringify(dotStorage.refTest.New));

About

A persistent Javascript Object - Wrapper for localStorage to add full dot support

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages