remove getViewport example code in docs

This commit is contained in:
Matthew Griffith 2019-06-12 19:49:23 -04:00
parent 28aa3e1c86
commit 8237e65ef6

View File

@ -189,18 +189,7 @@ The main technique for responsiveness is to store window size information in you
Install the `Browser` package, and set up a subscription for [`Browser.Events.onResize`](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Events#onResize).
You'll also need to retrieve the initial window size. You can either use [`Browser.Dom.getViewport`](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom#getViewport):
Task.perform
(\window ->
WindowResize
{ width = round window.viewport.width
, height = round window.viewport.height
}
)
Browser.Dom.getViewport
Or pass in `window.innerWidth` and `window.innerHeight` as flags to your program, which is the preferred way. This requires minor setup on the JS side, but allows you to avoid the state where you don't have window info.
You'll also need to retrieve the initial window size. You can either use [`Browser.Dom.getViewport`](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom#getViewport) or pass in `window.innerWidth` and `window.innerHeight` as flags to your program, which is the preferred way. This requires minor setup on the JS side, but allows you to avoid the state where you don't have window info.
@docs Device, DeviceClass, Orientation, classifyDevice