Expose sync function
parent
4e378a5f50
commit
005e103389
|
@ -63,7 +63,7 @@ sendMessageEvent env data =
|
||||||
-}
|
-}
|
||||||
sync :
|
sync :
|
||||||
E.Envelope a
|
E.Envelope a
|
||||||
-> { timeout : Int, toMsg : Msg -> msg }
|
-> { toMsg : Msg -> msg }
|
||||||
-> Cmd msg
|
-> Cmd msg
|
||||||
sync env data =
|
sync env data =
|
||||||
ITask.run
|
ITask.run
|
||||||
|
@ -72,7 +72,7 @@ sync env data =
|
||||||
{ fullState = Nothing
|
{ fullState = Nothing
|
||||||
, presence = env.settings.presence
|
, presence = env.settings.presence
|
||||||
, since = env.context.nextBatch
|
, since = env.context.nextBatch
|
||||||
, timeout = Just data.timeout
|
, timeout = Just env.settings.syncTime
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
(Context.apiFormat env.context)
|
(Context.apiFormat env.context)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module Matrix exposing
|
module Matrix exposing
|
||||||
( Vault, fromUserId, fromUsername
|
( Vault, fromUserId, fromUsername
|
||||||
, VaultUpdate, update
|
, VaultUpdate, update, sync
|
||||||
, addAccessToken, sendMessageEvent
|
, addAccessToken, sendMessageEvent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ support a monolithic public registry. (:
|
||||||
|
|
||||||
## Keeping the Vault up-to-date
|
## Keeping the Vault up-to-date
|
||||||
|
|
||||||
@docs VaultUpdate, update
|
@docs VaultUpdate, update, sync
|
||||||
|
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
@ -141,6 +141,17 @@ sendMessageEvent data =
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{-| Synchronize the Vault with the Matrix API.
|
||||||
|
|
||||||
|
Effectively, this task asks the Matrix API to provide the latest information,
|
||||||
|
which will be returned as your VaultUpdate.
|
||||||
|
|
||||||
|
-}
|
||||||
|
sync : (VaultUpdate -> msg) -> Vault -> Cmd msg
|
||||||
|
sync toMsg (Vault vault) =
|
||||||
|
Api.sync vault { toMsg = Types.VaultUpdate >> toMsg }
|
||||||
|
|
||||||
|
|
||||||
{-| Using new VaultUpdate information, update the Vault accordingly.
|
{-| Using new VaultUpdate information, update the Vault accordingly.
|
||||||
|
|
||||||
This allows us to change our perception of the Matrix environment: has anyone
|
This allows us to change our perception of the Matrix environment: has anyone
|
||||||
|
|
Loading…
Reference in New Issue