mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
added typing of mozilla localForage library
This commit is contained in:
26
localForage/localForage.d.ts
vendored
Normal file
26
localForage/localForage.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Type definitions for Mozilla's localForage
|
||||
// Project: https://github.com/mozilla/localforage
|
||||
// Definitions by: david pichsenmeister <https://github.com/3x14159265>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module lf {
|
||||
interface ILocalForage<T> {
|
||||
clear(): void
|
||||
key(index: number): T
|
||||
length: number
|
||||
getItem(key: string, callback: ICallback<T>)
|
||||
getItem(key: string): IPromise<T>
|
||||
setItem(key: string, value: T, callback: ICallback<T>)
|
||||
setItem(key: string, value: T): IPromise<T>
|
||||
removeItem(key: string, callback: ICallback<T>)
|
||||
removeItem(key: string): IPromise<T>
|
||||
}
|
||||
|
||||
interface ICallback<T> {
|
||||
(data: T): void
|
||||
}
|
||||
|
||||
interface IPromise<T> {
|
||||
then(callback: ICallback<T>): void
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user