diff --git a/README.md b/README.md index ab4a8cdae..2095f510b 100755 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ List of Definitions * [Levelup](https://github.com/rvagg/node-levelup) (by [Bret Little](https://github.com/blittle)) * [linq.js](http://linqjs.codeplex.com/) (by [Marcin Najder](https://github.com/marcinnajder)) * [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone](https://github.com/vbortone)) +* [localForage](https://github.com/mozilla/localForage) (by [david pichsenmeister](https://github.com/3x14159265)) * [Lodash](http://lodash.com/) (by [Brian Zengel](https://github.com/bczengel)) * [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle)) * [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr)) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts new file mode 100644 index 000000000..f1a416dcf --- /dev/null +++ b/localForage/localForage-tests.ts @@ -0,0 +1,34 @@ +/// + +declare var localForage: lf.ILocalForage +declare var callback: lf.ICallback +declare var promise: lf.IPromise + +() => { + localForage.clear() + localForage.length + localForage.key(0) + + localForage.getItem("key", (str: string) => { + var newStr: string = str + }) + localForage.getItem("key").then((str: string) => { + var newStr: string = str + }) + + localForage.setItem("key", "value", (str: string) => { + var newStr: string = str + }) + localForage.setItem("key", "value").then((str: string) => { + var newStr: string = str + }) + + localForage.removeItem("key", (str: string) => { + var newStr: string = str + }) + localForage.removeItem("key").then((str: string) => { + var newStr: string = str + }) + + promise.then(callback) +} diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 71ccaba3c..c3d0371d0 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -8,11 +8,11 @@ declare module lf { clear(): void key(index: number): T length: number - getItem(key: string, callback: ICallback) + getItem(key: string, callback: ICallback): void getItem(key: string): IPromise - setItem(key: string, value: T, callback: ICallback) + setItem(key: string, value: T, callback: ICallback): void setItem(key: string, value: T): IPromise - removeItem(key: string, callback: ICallback) + removeItem(key: string, callback: ICallback): void removeItem(key: string): IPromise }