71 lines
1.4 KiB
Elm

{-
Copyright 2020 Eike K. & Contributors
SPDX-License-Identifier: AGPL-3.0-or-later
-}
port module Ports exposing
( checkSearchQueryString
, initClipboard
, printElement
, receiveCheckQueryResult
, receiveUiSettings
, receiveWsMessage
, removeAccount
, requestUiSettings
, setAccount
, setUiTheme
)
import Api.Model.AuthResult exposing (AuthResult)
import Data.QueryParseResult exposing (QueryParseResult)
import Data.UiSettings exposing (StoredUiSettings)
import Data.UiTheme exposing (UiTheme)
{-| Save the result of authentication to local storage.
-}
port setAccount : AuthResult -> Cmd msg
port removeAccount : () -> Cmd msg
port internalSetUiTheme : String -> Cmd msg
port checkSearchQueryString : String -> Cmd msg
port receiveCheckQueryResult : (QueryParseResult -> msg) -> Sub msg
port initClipboard : ( String, String ) -> Cmd msg
port receiveUiSettings : (StoredUiSettings -> msg) -> Sub msg
port requestUiSettings : AuthResult -> Cmd msg
{-| Creates a new window/tab, writes the contents of the given element
and calls the print dialog.
-}
port printElement : String -> Cmd msg
{-| Receives messages from the websocket.
-}
port receiveWsMessage : (String -> msg) -> Sub msg
--- Higher level functions based on ports
setUiTheme : UiTheme -> Cmd msg
setUiTheme theme =
internalSetUiTheme (Data.UiTheme.toString theme)