Skip to content

Latest commit

 

History

History
36 lines (34 loc) · 705 Bytes

README.md

File metadata and controls

36 lines (34 loc) · 705 Bytes

objectStorage

what can it do

Allow use setitems with field of object in localstorage

Getting Started

  • setItem:
/**
 * @param  {string} field "object.key"
 */
objectStorage.setItem(field: string, value: any);
// eg:
objectStorage.setItem('example.test', 'test');
  • getItem:
/**
 * @param  {string} field "object.key"
 */
objectStorage.getItem(field: string);
// eg:
objectStorage.setItem('example.test'); // 'test'
  • switch to sessionStorage
objectStorage.setType('session');
  • switch to LocalStorage
objectStorage.setType('local');
  • get current type
objectStorage.getType(); // 'local' or 'session'