| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-09-13 16:51:08 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-09-13 16:51:08 +0200 | 
| commit | 9ec5806bc721734923ff4c93f7ef1f97a6a03248 (patch) | |
| tree | c80b737a8bf0cc6e311c4fe7256f68e7ea8e158a /src/Comm/GetID.elm | |
Starting an browser extension for TO...
Diffstat (limited to 'src/Comm/GetID.elm')
| -rw-r--r-- | src/Comm/GetID.elm | 43 | 
1 files changed, 43 insertions, 0 deletions
| diff --git a/src/Comm/GetID.elm b/src/Comm/GetID.elm new file mode 100644 index 0000000..14d668c --- /dev/null +++ b/src/Comm/GetID.elm @@ -0,0 +1,43 @@ +module Comm.GetID exposing (try) + +-- Elm ------------------------------------------------------------------------- +import Json.Encode + +-- Extension ------------------------------------------------------------------- +import Comm.Send + +import Constants.IO + +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- TYPES ------------------------------------------------------------------------ +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +try_encoding : String -> Struct.Model.Type -> (Maybe Json.Encode.Value) +try_encoding player_id model = +   let +      encoded_player_id = (Json.Encode.string player_id) +   in +      (Just +         (Json.Encode.object +            [ +               ("id", encoded_player_id) +            ] +         ) +      ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +try : Struct.Model.Type -> String -> (Maybe (Cmd Struct.Event.Type)) +try model = +   (Comm.Send.try_sending +      model +      Constants.IO.get_battles_handler +      (try_encoding player_id) +   ) | 


