You probably need something like:
init result =
urlUpdate result
(update Initialize
{ editorText = exampleSlides
, markdown = ""
, slidesText = Array.empty
, currentSlide = 0
, keycode = 0
}
)
Take a look at the url-parser example for inspiration.
https://github.com/evancz/url-parser/blob/1.0.0/examples/App.elm
If you want "edit" to be the route that people start with, define the Edit
Page and set that as the default in the initial model.
Also, as a personal comment, it looks somehow "wrong" for me to delegate
the initialization to a message in `update`.
I think that the code from the `Initialize` case should be in `init`. I
like to look at `init` and fully understand from where the app state
starts.
On Sun, Jun 5, 2016 at 4:59 PM, Ronn Ross <[email protected]> wrote:
> I'm trying to integrate navigation
> <http://package.elm-lang.org/packages/elm-lang/navigation/1.0.0/> into my
> app. I'm using
> Navigation.program
>
>
> instead of
> Html.program
>
>
> It seems with Navigation.program that a result param is now being passed
> into init. Previous to this change I was initializing my app like so
>
> init : ( Model, Cmd Msg )
> init =
> update Initialize
> ({ editorText = exampleSlides
> , markdown = ""
> , slidesText = Array.empty
> , currentSlide = 0
> , mode = Edit
> , keycode = 0
> }
> )
>
>
> I'm moving 'mode' out into the route eventually. I was trying something
> like
>
> init result =
> urlUpdate result "edit" Initialize
> ({ editorText = exampleSlides
> , markdown = ""
> , slidesText = Array.empty
> , currentSlide = 0
> , keycode = 0
> }
> )
>
>
> "edit" being the route I want to start with. So I'm having trouble
> figuring out how to init the model and call the first route that will set
> the model. Can someone point me in the right direction?
>
> Here is the not working code on a branch
> https://github.com/ronnross/razzle-dazzle/tree/navigation.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.