diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts
index bb824b7312..6f162e8c4b 100644
--- a/localForage/localForage-tests.ts
+++ b/localForage/localForage-tests.ts
@@ -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
+ });
}
\ No newline at end of file
diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts
index d169d01e3f..cd12bb4f32 100644
--- a/localForage/localForage.d.ts
+++ b/localForage/localForage.d.ts
@@ -6,7 +6,7 @@
///
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;
setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void;
defineDriver(driver: LocalForageDriver): Promise;
@@ -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;
+}
\ No newline at end of file