uuStorage.js
uuStorage.js は、HTML5 の Client Side Storage (WebStorage) のフォールバックな実装です。
http://uupaa-js-spinoff.googlecode.com/svn/trunk/uuStorage.js/README.htm
中身は、以下のシングルトンなクラスで構成されてます。
- Storage (Storage auto detector)
- LocalStorage (window.localStorage)
- FlashStorage (SharedObject)
- IEStorage (userData behavior)
- CookieStorage (Cookie)
- MemStorage (on memory storage)
I/F はこんな感じ
uu.Class.singleton("Storage", { nth, // nth(index:Number):String get, // get(key:String):String set, // set(key:String, value:String):Boolean size, // size():Hash { used, max } pairs, // pairs():Number clear, // clear() remove, // remove(key:String) getAll, // getAll():Hash saveToServer, // saveToServer(url:String, option:AjaxOptionHash = void, callback:Function = void) loadFromServer // loadFromServer(url:String, option:JSONPOptionHash = void, callback:Function = void) });
今年の1月ごろに作成したやつと大体一緒です。
デモ(まだちょっとしかない)
- GeoLocation とってきて、Storage にマージするとか
- key/value pair を色々操作するとか、ストレージの最大値を調べるとか
ドキュメントがスカスカなのはそのうち改善されると思います。
コメント付きのソースコードが見たい方はこのへんを
http://code.google.com/p/uupaa-js/source/browse/trunk/0.7/class/