Skip to content

Commit

Permalink
exposed GraphicSVG.EllieApp, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
CSchank committed Nov 6, 2018
1 parent a21ce22 commit 56b3fd2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 30 deletions.
5 changes: 3 additions & 2 deletions elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"name": "MacCASOutreach/graphicsvg",
"summary": "Library for creating SVG graphics",
"license": "BSD-3-Clause",
"version": "4.0.0",
"version": "4.1.0",
"exposed-modules": [
"GraphicSVG",
"GraphicSVG.App"
"GraphicSVG.App",
"GraphicSVG.EllieApp"
],
"elm-version": "0.19.0 <= v < 0.20.0",
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/GraphicSVG/App.elm
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,12 @@ which will be automatically called each time the browser window is refreshed
of the form `Float -> GetKeyState -> UserMsg` and the other is
```
{
init = model
, view = view
, update = update
, subscriptions = subscriptions
, onUrlRequest = OnUrlRequest
, onUrlChange = OnUrlChange
init = model
, view = view
, update = update
, subscriptions = subscriptions
, onUrlRequest = OnUrlRequest
, onUrlChange = OnUrlChange
}
where init is the model and initial commands, view is a collage and a title,
update is the usual update function with commands, subscriptions are things
Expand Down
47 changes: 25 additions & 22 deletions src/GraphicSVG/EllieApp.elm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ they are built upon `GraphicSVG.ellieApp` for compatibility with that platform.
@docs InputHandler, GetKeyState, Keys, KeyState
# Barebones ellieApp with keyboard and time
@docs EllieAppWithTick, ellieAppWithTick
-}

import Browser exposing (UrlRequest(..))
Expand Down Expand Up @@ -455,29 +460,27 @@ type alias NotificationsApp userModel userMsg =
graphics. Note that your `view` function needs a `model` parameter now, which in this
example is the colour of the shape:
view model =
collage 500 500
[ circle 10 |> filled model |> notifyTap Change
][ circle 10 |> filled model |> notifyTap Change
]
collage 500 500
[ circle 10 |> filled model |> notifyTap Change
]
`notificationsApp` takes a parameter like:
{
model = model
, view = view
, update = update
model = model
, view = view
, update = update
}
so the functions that would be required to make the above `view` function work
are as follows:
type Msg
= Change
type Msg = Change
update msg model =
case msg of
Change ->
green
main =
notificationsApp
{ model = red -- causes circle to start red
, update = update -- function which changes the model
, view = view
case msg of
Change ->
green
main = notificationsApp
{
model = red -- causes circle to start red
, update = update -- function which changes the model
, view = view
}
which will cause the drawn red circle to change to green the first time
it is mouse clicked or tapped.
Expand Down Expand Up @@ -718,18 +721,18 @@ they can be substituted for these names.
type alias EllieAppWithTick flags userModel userMsg =
App flags ( userModel, HiddenModel userMsg ) (HiddenMsg userMsg)

{-
{-|
A GraphicSVG.ellieApp with automatic time and keyboard presses passed into the update function.
`ellieAppWithTick` takes two parameters: one is your own type of `InputHandler` message
which will be automatically called each time the browser window is refreshed
(30 times per second)
of the form `Float -> GetKeyState -> UserMsg` and the other is
```
{
init = model
, view = view
, update = update
, subscriptions = subscriptions
init = model
, view = view
, update = update
, subscriptions = subscriptions
}
where init is the model and initial commands, view is a collage and a title,
update is the usual update function with commands, and subscriptions are things
Expand Down

0 comments on commit 56b3fd2

Please sign in to comment.