I would really like to be able to use local storage in elm. There have been several libraries that implement this, but none of them have been updated to elm 0.17. So far the advice I've seen is just to wait, but I'm tired of waiting.
The specification for web storage is here: https://www.w3.org/TR/webstorage/ This is the API I've devised based on that specification: type StorageArea = LocalStorage | SessionStorage type StorageAction = Clear | Update { key : String, oldValue : Maybe String, newValue : Maybe String } type alias StorageEvent = { action: StorageAction, url : String, storageArea : StorageArea } type SetItemError = QuotaExceededError length : StorageArea -> Task Never Int key : StorageArea -> Int -> Task Never (Maybe String) getItem : StorageArea -> String -> Task Never (Maybe String) setItem : StorageArea -> String -> String -> Task SetItemError () removeItem : StorageArea -> String -> Task Never () clear : StorageArea -> Task Never () sub : Sub StorageEvent Firstly, what general feedback do you have on this API? Secondly, I have a specific questions about sub: - Is there a naming convention for methods which return a subscription? - I notice that in some places, subscriptions are provided as methods (a -> msg) -> Sub msg, rather than simply Sub a. What is the reasoning behind this, and is it a convention I'm expected to follow? . -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
