summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Action/Ports.elm2
-rw-r--r--src/ElmModule/Update.elm6
-rw-r--r--src/Struct/Event.elm4
-rw-r--r--src/Struct/Flags.elm4
-rw-r--r--src/Update/StoreParams.elm24
5 files changed, 37 insertions, 3 deletions
diff --git a/src/Action/Ports.elm b/src/Action/Ports.elm
index c79d918..4d83077 100644
--- a/src/Action/Ports.elm
+++ b/src/Action/Ports.elm
@@ -1,4 +1,4 @@
port module Action.Ports exposing (..)
-port store_new_params : (Int, (List String)) -> (Cmd msg)
+port store_params : (Int, String) -> (Cmd msg)
port reset_params : () -> (Cmd msg)
diff --git a/src/ElmModule/Update.elm b/src/ElmModule/Update.elm
index 5baa84c..fbe8dfe 100644
--- a/src/ElmModule/Update.elm
+++ b/src/ElmModule/Update.elm
@@ -7,6 +7,7 @@ import Struct.Event
import Struct.Model
import Update.HandleServerReply
+import Update.StoreParams
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -27,6 +28,11 @@ update event model =
case event of
Struct.Event.None -> (model, Cmd.none)
+ (Struct.Event.SetUsername str) -> (model, Cmd.none)
+ (Struct.Event.SetID str) -> (model, Cmd.none)
+ (Struct.Event.SetURLPrefix str) -> (model, Cmd.none)
+ (Struct.Event.SetFrequency val) -> (Update.StoreParams.apply_to model)
+
(Struct.Event.Failed err) ->
(
(Struct.Model.invalidate err new_model),
diff --git a/src/Struct/Event.elm b/src/Struct/Event.elm
index 3bf64d7..68bca98 100644
--- a/src/Struct/Event.elm
+++ b/src/Struct/Event.elm
@@ -13,6 +13,10 @@ import Struct.ServerReply
type Type =
None
| Failed Struct.Error.Type
+ | SetUsername String
+ | SetID String
+ | SetURLPrefix String
+ | SetFrequency Int
| ServerReplied (Result Http.Error (List Struct.ServerReply.Type))
attempted : (Result.Result err val) -> Type
diff --git a/src/Struct/Flags.elm b/src/Struct/Flags.elm
index ccda57a..d9d2dcd 100644
--- a/src/Struct/Flags.elm
+++ b/src/Struct/Flags.elm
@@ -17,7 +17,7 @@ import Util.List
type alias Type =
{
frequency : Int,
- players : (List String)
+ players : String
}
--------------------------------------------------------------------------------
@@ -30,5 +30,5 @@ type alias Type =
get_frequency : Type -> Int
get_frequency flags = flags.frequency
-get_players : Type -> (List String)
+get_players : Type -> String
get_players flags = flags.players
diff --git a/src/Update/StoreParams.elm b/src/Update/StoreParams.elm
new file mode 100644
index 0000000..3955ecd
--- /dev/null
+++ b/src/Update/StoreParams.elm
@@ -0,0 +1,24 @@
+module Update.StoreParams exposing (apply_to)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Login -----------------------------------------------------------------------
+import Action.Ports
+
+import Struct.Event
+import Struct.Flags
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
+apply_to model =
+ (
+ model,
+ (Action.Ports.store_params (5, ""))
+ )