Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ae995c8
Rolled back to version 4.0.3, which I preferred.
rupertlssmith Jun 16, 2020
3ba80d8
Rolled back to version 4.0.3, which I preferred.
rupertlssmith Jun 16, 2020
d631924
Reset the version and changed the package group.
rupertlssmith Jun 16, 2020
6f6df5d
Trimming off everything except the main src.
rupertlssmith Jun 16, 2020
27799c4
Dropped the Dict based simuluation of local storage. Only want the re…
rupertlssmith Jun 16, 2020
2e4a265
Merged in the SharedTypes module.
rupertlssmith Jun 16, 2020
4abd464
Dropped the String alias.
rupertlssmith Jun 16, 2020
77a3462
Will rewrite comments.
rupertlssmith Jun 16, 2020
0fd0a7e
Removed overly simple type aliases.
rupertlssmith Jun 16, 2020
eadfdac
Trimmed the API down to a minimal set.
rupertlssmith Jun 16, 2020
4b15b2c
Documented.
rupertlssmith Jun 16, 2020
dd559fa
Added the response handling back.
rupertlssmith Jun 16, 2020
fc0de60
Wrote the readme.
rupertlssmith Jun 17, 2020
7e5b5a9
Putting all the responses within the Operation type.
rupertlssmith Jun 29, 2020
2e7779c
Renaming and tidying up decoders.
rupertlssmith Jun 29, 2020
ee946a9
Moved out the code samples from the README into a Gist. Will then mak…
rupertlssmith Jun 29, 2020
a1827f5
Working on the README.
rupertlssmith Jun 29, 2020
cb2e4ed
Starting point for creating the npm package.
rupertlssmith Jun 29, 2020
1686bc5
Setting up package.json build.
rupertlssmith Jun 29, 2020
2e2e17a
Adjusting dependencies to remove jquery.
rupertlssmith Jun 29, 2020
27ce250
Bumped for release.
rupertlssmith Jun 29, 2020
9d39aaf
Stripping the prefix from listed keys. Using LocalStorage type to get…
rupertlssmith Jun 30, 2020
2f7c8da
Bumped for release.
rupertlssmith Jun 30, 2020
b2ae317
Remove unused dependencies
elm-review-bot Apr 18, 2021
9742730
Remove unused dependencies
elm-review-bot Apr 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
elm-stuff
docs.json
index.js
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
Published as the [billstclair/elm-localstorage](http://package.elm-lang.org/packages/billstclair/elm-localstorage/latest) package at elm-lang.org
**Contacts for Support**
- @rupertlssmith on https://elmlang.slack.com
- @rupert on https://discourse.elm-lang.org

This module is built on top of the [billstclair/elm-port-funnel](http://package.elm-lang.org/packages/billstclair/elm-port-funnel/latest) package, so it can share two ports with other port funnel modules. It requires Elm 0.19.
# elm-localstorage

I've built many projects that use JavaScript's `localStorage` mechanism for persistent storage. Enough to know the features I need. This package makes that experience available to the community.
elm-localstorage provides a simple and minimal API for working with local storage.

Some ideas here are cribbed from Paul Statezny's [knledg/elm-local-storage-ports](https://github.com/knledg/elm-local-storage-ports), but his package is not in the Elm repository. This one also provides an API-compatible pure Elm version that you can use it from `elm reactor` during development (with only session persistence, but that suffices for development).
# Setting up the javascript side and implementing the Elm ports

See the [example](https://github.com/billstclair/elm-localstorage/tree/master/example) directory for use of both simulated ports, which work in `elm reactor`, and real ports.
As packages with ports cannot be published, the types of the ports are defined
instead. It is up to the user of this package in an application to provide the
port implementations.

The example is live at [lisplog.org/localstorage](https://lisplog.org/localstorage/).
Example code for how to do this can be found in this Gist:

To use the real ports with your own application, create the two ports, `cmdPort` and `subPort`, as is done in [example/Main.elm](https://github.com/billstclair/elm-localstorage/tree/master/example/Main.elm). Copy the [site](https://github.com/billstclair/elm-localstorage/tree/master/site) directory, inluding its `js` subdirectory. In `index.html`, change the `<title>`, and, if necessary change `Main` to the name of your top-level application module. If you want to use different names for the ports, you can change those here as well.
https://gist.github.com/rupertlssmith/5c4e3be17830e40d64168f390f4aea24

Finally, compile your application Elm file into `site/elm.js`:
The javascript code can be copied from this Gist, or it is also available as an
npm package. To install the npm package do:

cd ...
elm make Main.elm --output site/elm.js

Happy hacking!
> npm install @the-sett/elm-localstorage

Bill St. Clair<br/>
24 March, 2018

# Origins

Originally published as [billstclair/elm-localstorage](http://package.elm-lang.org/packages/billstclair/elm-localstorage/latest)
version 4.0.3. The API changed as the package evolved but I preferred the simpler
presentation in version 4.x. This package was forked from 4.0.3 and trimmed down
to provide a minimal and simple local storage package. Thanks to Bill St. Clair
for the original work.
3 changes: 0 additions & 3 deletions bin/m

This file was deleted.

3 changes: 1 addition & 2 deletions elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
"dependencies": {
"billstclair/elm-port-funnel": "1.1.1 <= v < 2.0.0",
"elm/core": "1.0.0 <= v < 2.0.0",
"elm/html": "1.0.0 <= v < 2.0.0",
"elm/json": "1.0.0 <= v < 2.0.0",
"elm-community/dict-extra": "2.3.1 <= v < 3.0.0",
"pzp1997/assoc-list": "1.0.0 <= v < 2.0.0"
},
"test-dependencies": {
"elm-explorations/test": "1.0.0 <= v < 2.0.0"
}
}
}
Loading