viewport
An object containing information about the user’s viewport, e.g. browser window.
viewport?: ViewportContext
Notes
- You can use
app.viewport
directly, or using a binding (bound to"viewport"
, since all views and activities are ultimately attached to the global application context, i.e.app
). - Refer to ViewportContext for available properties of
app.viewport
.
Examples
// Use the viewport size in code:
if (app.viewport.portrait) {
// ... do something in portrait mode
}
// Use the viewport size in a view:
ui.cell(
{ hidden: bound("!viewport.portrait") }
// ... portrait cell content
)
Related
- class GlobalContextA singleton class that represents the global application state.
- interface ViewportContextInterface definition for an object that contains information about the user’s viewport, e.g. browser window.