@rtorcato/browser-common / screen
screen
Functions
getScreenWidth()
getScreenWidth():
number|null
Defined in: screen/index.ts:10
Gets the current screen width in pixels.
Example
import { getScreenWidth } from '@rtorcato/browser-common/screen'
const w = getScreenWidth()
Returns
number | null
The screen width, or null if not in a browser.
getScreenHeight()
getScreenHeight():
number|null
Defined in: screen/index.ts:26
Gets the current screen height in pixels.
Example
import { getScreenHeight } from '@rtorcato/browser-common/screen'
const h = getScreenHeight()
Returns
number | null
The screen height, or null if not in a browser.
getViewportWidth()
getViewportWidth():
number|null
Defined in: screen/index.ts:42
Gets the current viewport width in pixels.
Example
import { getViewportWidth } from '@rtorcato/browser-common/screen'
const w = getViewportWidth()
Returns
number | null
The viewport width, or null if not in a browser.
getViewportHeight()
getViewportHeight():
number|null
Defined in: screen/index.ts:58
Gets the current viewport height in pixels.
Example
import { getViewportHeight } from '@rtorcato/browser-common/screen'
const h = getViewportHeight()
Returns
number | null
The viewport height, or null if not in a browser.
isLandscape()
isLandscape():
boolean
Defined in: screen/index.ts:74
Checks if the screen is currently in landscape orientation.
Example
import { isLandscape } from '@rtorcato/browser-common/screen'
if (isLandscape()) renderWide()
Returns
boolean
True if landscape, false if portrait or not in a browser.
isPortrait()
isPortrait():
boolean
Defined in: screen/index.ts:90
Checks if the screen is currently in portrait orientation.
Example
import { isPortrait } from '@rtorcato/browser-common/screen'
if (isPortrait()) renderStacked()
Returns
boolean
True if portrait, false if landscape or not in a browser.