Closed geoidesic closed 4 years ago
Here's how to do it in ES6 with web pack. This will instal both setItems
and getItems
:
import localforage from "localforage";
import "localforage-getitems";
import "localforage-setitems";
import { extendPrototype as extendPrototypeSet } from "localforage-setitems";
import { extendPrototype as extendPrototypeGet } from "localforage-getitems";
extendPrototypeSet(localforage);
extendPrototypeGet(localforage);
I'm using ES6 imports on a VueJs SFC SPA. I tried the Typescript syntax but couldn't get it to work at all. It doesn't throw errors but the
setItems
method isn't added. (I get the same problem withgetItems
btw)Error:
Also I think the Typescript example has a case typo in it; should be
localforage
notlocalForage
when importing.