Check out a free preview of the full Introduction to Elm, v2 course:
The "Browser.element" Lesson is part of the full, Introduction to Elm, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Richard introduces Browser.element, which returns a tuple and allows the user to execute Commands.

Get Unlimited Access Now

Transcript from the "Browser.element" Lesson

>> Richard Feldman: Now previously, when we introduced Browser, back in part three when we introduced Browser.sandbox, which was the way that we had our program up and running and able to process interaction, update took this type signature. It took a message and a model and returned a model. Now, we're gonna be upgrading to Browser.element, which has a different signature for update.

[00:00:23] It looks basically the same as before, except now it's returning a tuple of Model and Cmd Msg, and that's the only difference. Everything else is essentially the same as before, as we had with the sandbox, except now we're able to actually do some commands in addition to our, that's a tuple sight, it's the first tuple we've encountered so far.

>> Richard Feldman: Okay, and so essentially, each of our branches of update is still going to have that case expression that's gonna check each of our messages and make sure that we're handling everything properly. And now each of those branches, instead of returning Model, or maybe a record update on Model, it's gonna do that and also some sort of command, like pickGreeting, for example.

[00:01:07] Or, as is so often the case, we have no commands that we want to run, you just say Cmd.none. And that says don't do anything, I just wanna update the model, or maybe I don't even wanna update the model.