Generate an Elm module for saving and loading data to an external key-value data source.
For guidance on how to wire the generated code to work with JavaScript through ports, take a look at the examples in the package Github repo.
Generates an Elm file from a passed Store (which you can create with the init
function) and some JSON (as a Json.Decode.Value).
If the passed Json cannot be decoded, the generated code will be for managing arbitrary key value pairs with the store. No decoding or encoding will be generated. While this may still be useful, it's less useful than getting all your serialization for free!
The generated code has its behavior documented. If you'd like to understand how your store is working internally, generate some code and read the comments!
Create a new store. You can pass this to the
generatefunction to generate code with elm-codegen.