Returns a storage object for setting and getting local storage items.


No parameters


storage = STORAGE();
KEY = 'item_key';
storage.setItem(KEY, 'hello world');

// Sets an item in local storage, must be a string
item = storage.getItem(KEY);

// Gets an item from storage if it exists, otherwise returns null
geom = { type: 'Point', coordinates: [-100, 40] };
storage.setItem('geometry', JSON.stringify(geom));

anotherGeom = JSON.parse(storage.getItem('geometry'));

// Use JSON.stringify and JSON.parse to serialize and deserialize objects in local storage

// Removes an item from storage

// Removes all items from storage

Did this page help you?