Merge pull request #5805 from stephenlautier/localforage

updated localforage definitions + angular-localforge (dependent)
This commit is contained in:
Masahiro Wakame
2015-10-14 13:27:05 +09:00
2 changed files with 28 additions and 3 deletions
+11 -1
View File
@@ -52,4 +52,14 @@ declare var localForage: LocalForage;
localForage.removeItem("key").then(() => {
});
}
var config = localForage.config({
name: "testyo",
driver: localForage.LOCALSTORAGE
});
var store = localForage.createInstance({
name: "da instance",
driver: localForage.LOCALSTORAGE
});
}
+17 -2
View File
@@ -6,7 +6,7 @@
/// <reference path="../es6-promise/es6-promise.d.ts" />
interface LocalForageOptions {
driver?: LocalForageDriver | LocalForageDriver[];
driver?: string | LocalForageDriver | LocalForageDriver[];
name?: string;
@@ -46,9 +46,19 @@ interface LocalForage {
WEBSQL: string;
INDEXEDDB: string;
config(options: LocalForageOptions): void;
/**
* Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded.
* If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver()
* @param {ILocalForageConfig} options?
*/
config(options: LocalForageOptions): boolean;
createInstance(options: LocalForageOptions): LocalForage;
driver(): LocalForageDriver;
/**
* Force usage of a particular driver or drivers, if available.
* @param {string} driver
*/
setDriver(driver: string | string[]): Promise<void>;
setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void;
defineDriver(driver: LocalForageDriver): Promise<void>;
@@ -79,3 +89,8 @@ interface LocalForage {
iterate(iteratee: (value: any, key: string, iterationNumber: number) => any,
callback: (err: any, result: any) => void): void;
}
declare module "localforage" {
var localforage: LocalForage;
export default localforage;
}