[{"name":"PortFunnel.LocalStorage","comment":" The `PortFunnelLocalStorage` uses the JavaScript `localStorage` facility to persistently store key/value pairs.\n\nIt is a `billstclair/elm-port-funnel` `PortFunnel` funnel.\n\n\n# Types\n\n@docs Message, Response, State, Key\n\n\n# Components of a `PortFunnel.FunnelSpec`\n\n@docs moduleName, moduleDesc, commander\n\n\n# Initial `State`\n\n@docs initialState\n\n\n# Sending a `Message` out the `Cmd` Port\n\n@docs send\n\n\n# Creating Messages\n\nThe `Message` type is opaque, so there are functions to create the four messages\nyou may pass to `send`.\n\n@docs get, put, listKeys, clear\n\n\n# Conversion to Strings\n\n@docs toString, toJsonString\n\n\n# Simulator\n\n@docs makeSimulatedCmdPort\n\n\n# Non-standard Functions\n\n@docs isLoaded, getPrefix, encode, decode\n\n","unions":[{"name":"Message","comment":" Messages that can be sent/received to/from the JavaScript code.\n\n`Startup` is received after the JS code loads. It sets the `isLoaded` flag in our state, and reports `NoResponse`.\n\n`Get` is sent to request a read.\n\n`Put` is sent to request a write or received in response to `Get`. A value of `Nothing` means remove that key/value pair when sent or no value in the store when received.\n\n`ListKeys` is sent to request a list of keys.\n\n`Keys` is received in response to `ListKeys`.\n\n`Clear` is sent to clear keys starting with the prefix. No response is sent.\n\nThe `Simulate<Foo>` messages are returned by the simulator and simulated by the `process` function (not exposed, except inside of `moduleDesc`).\n\n","args":[],"cases":[]},{"name":"Response","comment":" A `MessageResponse` is used to return values for `Get` and `ListKeys`.\n","args":[],"cases":[["NoResponse",[]],["GetResponse",["{ key : PortFunnel.LocalStorage.Key, value : Maybe.Maybe PortFunnel.LocalStorage.Value }"]],["ListKeysResponse",["{ prefix : String.String, keys : List.List PortFunnel.LocalStorage.Key }"]]]},{"name":"State","comment":" Our internal state.\n","args":[],"cases":[]}],"aliases":[{"name":"Key","comment":" A convenience type for keys in the store. Same as `String`.\n","args":[],"type":"String.String"}],"values":[{"name":"clear","comment":" Return a message to remove all keys beginning with a prefix.\n\nA prefix of `\"\"` means to remove all keys.\n\n","type":"PortFunnel.LocalStorage.Prefix -> PortFunnel.LocalStorage.Message"},{"name":"commander","comment":" Responsible for sending a `CmdResponse` back through the port.\n\nThis funnel doesn't initiate any sends, so this function always returns `Cmd.none`.\n\n","type":"(PortFunnel.GenericMessage -> Platform.Cmd.Cmd msg) -> PortFunnel.LocalStorage.Response -> Platform.Cmd.Cmd msg"},{"name":"decode","comment":" Turn a `GenericMessage` into a `Message`.\n","type":"PortFunnel.GenericMessage -> Result.Result String.String PortFunnel.LocalStorage.Message"},{"name":"encode","comment":" Turn a `Message` into a `GenericMessage`.\n","type":"PortFunnel.LocalStorage.Message -> PortFunnel.GenericMessage"},{"name":"get","comment":" Return a `Message` to get a value from local storage.\n","type":"PortFunnel.LocalStorage.Key -> PortFunnel.LocalStorage.Message"},{"name":"getPrefix","comment":" Get the prefix from the state.\n","type":"PortFunnel.LocalStorage.State -> PortFunnel.LocalStorage.Prefix"},{"name":"initialState","comment":" The initial state.\n\nThe `Prefix` arg (plus a period, if non-blank) is prepended to all\nkeys sent to the backend, and removed from keys returned. It basically\ngive you a namespace in local storage, and usually matches your\napplication name. It allows multiple different Elm applications to be\nserved by the same domain without stepping on each other's state.\n\nThe state also stores a `Dict`, which acts as the backing store for simulation,\nand a flag saying whether the JavaScript code has sent its \"I'm loaded\" message\n(see `isLoaded`).\n\n","type":"PortFunnel.LocalStorage.Prefix -> PortFunnel.LocalStorage.State"},{"name":"isLoaded","comment":" Returns true if a `Startup` message has been processed.\n\nThis is sent by the port code after it has initialized.\n\n","type":"PortFunnel.LocalStorage.State -> Basics.Bool"},{"name":"listKeys","comment":" Return a `Message` to list all keys beginning with a prefix.\n","type":"PortFunnel.LocalStorage.Prefix -> PortFunnel.LocalStorage.Message"},{"name":"makeSimulatedCmdPort","comment":" Make a simulated `Cmd` port.\n","type":"(PortFunnel.LocalStorage.Value -> msg) -> PortFunnel.LocalStorage.Value -> Platform.Cmd.Cmd msg"},{"name":"moduleDesc","comment":" Our module descriptor.\n","type":"PortFunnel.ModuleDesc PortFunnel.LocalStorage.Message PortFunnel.LocalStorage.State PortFunnel.LocalStorage.Response"},{"name":"moduleName","comment":" The name of this funnel: \"LocalStorage\".\n","type":"String.String"},{"name":"put","comment":" Return a `Message` to put a value into local storage.\n\n`Nothing` for the value means to remove the key.\n\n","type":"PortFunnel.LocalStorage.Key -> Maybe.Maybe PortFunnel.LocalStorage.Value -> PortFunnel.LocalStorage.Message"},{"name":"send","comment":" Send a `Message` through a `Cmd` port.\n\nNote that this `send` function requires that you pass state,\nbut it is read-only, so you don't need to update your `Model` state\non return.\n\n","type":"(PortFunnel.LocalStorage.Value -> Platform.Cmd.Cmd msg) -> PortFunnel.LocalStorage.Message -> PortFunnel.LocalStorage.State -> Platform.Cmd.Cmd msg"},{"name":"toJsonString","comment":" Convert a `Message` to the same JSON string that gets sent\n\nover the wire to the JS code.\n\n","type":"PortFunnel.LocalStorage.Message -> String.String"},{"name":"toString","comment":" Convert a `Message` to a nice-looking human-readable string.\n","type":"PortFunnel.LocalStorage.Message -> String.String"}],"binops":[]}]