Project

memojs

0.0
No commit activity in last 3 years
No release in over 3 years
To use it, you must require memojs in your JavaScript manifest. Add this line to your application.js file: //= require memojs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0

Runtime

< 5.0, >= 3.1
 Project Readme

memojs

A lightweight wrapper around the localStorage API.

How to use

Add memojs to your Gemfile and require memojs in your JavaScript manifest. Add this line to your application.js file:

//= require memojs

window will now have a memo object with the following somewhat self-explanatory functions.

set(key, value) Adds value to the store using key

get(key) Returns the value for the given key. Returns null for keys without values.

keys() Returns an array with all keys present in the store

delete(key) Removes key from the store

clear() Removes all keys from the store

all() Returns a JavaScript object with all keys and their values.

Is JSON supported?

Yes. Under the hood memojs uses JSON.stringify/parse allowing you set objects and read objects.

memo.set("colors", ["red", "blue", "green"])
memo.get("colors")
=> ["red", "blue", "green"]

Supported browsers

memojs has only been tested with Chrome 34 for Mac, but should work with IE9+ and all recent versions of other browsers.