Renamed to FabienHenon/remote-resource. It is published under that name, and new versions come out there.
Versions published as calions-app/remote-resource still install under that name. 1 version of 1 come from the new location (see their notes).
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/FabienHenon/remote-resource.
What we checked: The repo moved to github.com/FabienHenon/remote-resource. Rebuilt with git archive from commit a994824ca95e of https://github.com/FabienHenon/remote-resource (zip prefix calions-app-remote-resource-a994824/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 88fe4ce7c5f90c3b45c6daee799f79ec487045d3.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/calions-app/remote-resource/zipball/1.0.0/
Remote Resource alllows you to handle foreground and background resources, using https://package.elm-lang.org/packages/krisajenkins/remotedata/latest/.
For instance, let's say you want to retrieve a list of posts. You are using the RemoteData package, thus you can handle the state of your request (Loading, Success, etc...). You will probably display a loading icon while your request is in progress, and once it has been fully retrieved you will display your posts. But now, let's say you know your posts have changed and you would like to update them. You will probably want to send another request to your webservice with the same Elm RemoteData you used when you first retrieved your posts. That means your users will see your posts disapear for a few milliseconds (depending on the latency and network speed), replaced by a loading icon, to be finally updated and displayed again to your users.
Now, with RemoteResource you can refresh your posts in the background. Than means that you keep displaying your "old" posts to your users,
and when the new data has been retrieved you can replace your old posts by the new ones without your users seeing some loading icon!
Definition of the RemoteResource.
error is the error type, usually a Http.Errorres is your final resource, the one you are trying to retrieveInitializes the remote resource. This is the first thing to do to get a brand new RemoteResource.
To mark you foreground resource as Loading.
Your background resource will be reset to NotAsked.
RemoteResource.init |> RemoteResource.loadingTo mark your background resource as Loading
This does not change your foreground resource.
RefreshPosts ->
( posts |> RemoteResource.reloading, Cmd.none )Set the foreground resource. This will reset the background resource to NotAsked.
Set the foreground resource without resetting the background resource.
If the foreground resource is in Loading state, this function will update the foreground resource.
Otherwise, this will update the background resource without changing the foreground resource.
That means that you can use this function both when this is the first time you retrieve your resources (in this case you want to set the foreground resource), and when you want to refresh your resources and you already have foreground resources (in this case, maybe you want to store your background resources and tell your users there are new resources awailable before replacing the foreground resources))
Directly update the background resource without changing the foreground resource
If the current background resource is in Success state, then we replace the foreground resource by the background resource and
we set the background resource to NotAsked
Get the current foreground resource
Get the current background resource
Get a tuple with the foreground resource and the background resource.
You will retrieve the final resource, thus, if the resource is not in Success state, the default resource will be returned.
Map your foreground resource (RemoteData.map is applied to the foreground resource)
Map your background resource (RemoteData.map is applied to the background resource)
Compare the foreground and the background resources to check if there are different (In this case you could tell your users new resources have arrived).
Success state this will return false.Success state but foreground resource is not in Success state this will return trueSuccess state the compare function you provide will be used to determine if the resources are different
This is just an alias for
RemoteData error res