sprinkles icon indicating copy to clipboard operation
sprinkles copied to clipboard

Add $pushItem(), $getItems(), & $getObject() to Storage.prototype

Open avand opened this issue 10 years ago • 0 comments

pushItem(k, v) {
  var a = getItems(k);
  a.push(v);
  localStorage.setItem(JSON.stringify(a));
}
getItems(k) {
  var a = getObject(k);
  if (a == null) a = [];
  return a;
}
getObject(k) {
  return JSON.parse(localStorage.getItem(k));
}

avand avatar Mar 18 '14 21:03 avand