Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rozek/localforage-esm
the "localForage" library bundled as an ECMAscript module
https://github.com/rozek/localforage-esm
indexeddb javascript localforage localstorage offline storage websql
Last synced: 2 months ago
JSON representation
the "localForage" library bundled as an ECMAscript module
- Host: GitHub
- URL: https://github.com/rozek/localforage-esm
- Owner: rozek
- License: apache-2.0
- Created: 2024-01-04T10:49:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-26T09:04:01.000Z (8 months ago)
- Last Synced: 2024-06-26T10:18:23.531Z (8 months ago)
- Topics: indexeddb, javascript, localforage, localstorage, offline, storage, websql
- Language: JavaScript
- Homepage:
- Size: 111 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# localforage-esm #
the "localForage" library bundled as an ECMAscript module
This repository provides the [localForage](https://github.com/localForage/localForage) library as an ECMAScript module (ESM).
## Background ##
If you are used to importing external modules - even within browser scripts (e.g., in a no-build environment) - using the localForage library becomes difficult (see issues [#831](https://github.com/localForage/localForage/issues/831) and [#976](https://github.com/localForage/localForage/issues/976)). And since the attempts to made relevant changes broke installations of existing users, all activities in that direction seem to have been stopped (see issues [#940](https://github.com/localForage/localForage/issues/940) and [#977](https://github.com/localForage/localForage/pull/977)).
This repository therefore **copies the source code of the original** distribution **and bundles it into an ECMAScript module** - nothing else.
But now you can easily `import localforage from 'localforage'` (or `import localForage from 'localforage'` if you prefer that capitalisation) as shown below
## Usage ##
```
{
"imports": {
"localforage":"https://rozek.github.io/localforage-esm/dist/localforage.esm.js"
}
}import localforage from 'localforage'
...```
Or, if you don't like import maps
```
import localforage from 'https://rozek.github.io/localforage-esm/dist/localforage.esm.js'
...```
## Build Instructions ##
You may easily build this module yourself.
Just install [NPM](https://docs.npmjs.com/) according to the instructions for your platform and follow these steps:
1. either clone this repository using [git](https://git-scm.com/) or [download a ZIP archive](https://github.com/rozek/localforage-esm/archive/refs/heads/main.zip) with its contents to your disk and unpack it there
2. open a shell and navigate to the root directory of this repository
3. run `npm install` in order to install the complete build environment
4. execute `npm run build` to create a new buildThat's it!
## License ##
Please note, that the original source code is licensed under Apache 2.0 - and since I simply copy it and just build the library in a different way, this repository has that license as well.