You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,13 +156,33 @@ You can use multiple instances of localForage at the same time. To create a new
156
156
name:'2nd',
157
157
driver:'localStorageWrapper'
158
158
});
159
+
160
+
var lf3 =$localForage.createInstance({
161
+
name:'3rd',
162
+
storeName:'kvpairs'
163
+
});
159
164
```
160
165
161
166
The parameters will inherit the default parameters that you might have configured in the config phase of your application (See [above](#configure-the-provider-) for details), but the new config object will overwrite them.
162
167
It means that you can have one instance using localStorage, and one instance using indexedDB/WebSQL, at the same time !
163
168
The instance will take the name that you will define in the config object. You can get an instance previously created by using the `instance` method:
164
169
```js
170
+
// DEPRECATED
165
171
var lf2 =$localForage.instance('2nd');
172
+
173
+
// NEW USAGE
174
+
var lf2 =$localForage.instance({
175
+
name:'2nd'
176
+
});
177
+
178
+
var lf3 =$localForage.instance({
179
+
name:'3rd',
180
+
storeName:'kvpairs'
181
+
});
182
+
183
+
var lf4 =$localForage.instance({
184
+
storeName:'example_store'
185
+
});
166
186
```
167
187
168
188
The `instance` method will return the default instance if you don't give a name parameter.
0 commit comments