Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: EventTarget
Source: JSObjects/Screen.cs
MDN Reference: Screen on MDN
The Screen interface represents a screen, usually the one on which the current window is being rendered, and is obtained using window.screen. https://developer.mozilla.org/en-US/docs/Web/API/Screen
| Signature | Description |
|---|---|
Screen(SpawnJSObjectReference _ref) |
Deserialization constructor |
| Property | Type | Access | Description |
|---|---|---|---|
AvailHeight |
int |
get | Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows. |
AvailLeft |
int? |
get | A number representing the x-coordinate (left-hand edge) of the available screen area. |
AvailTop |
int? |
get | A number representing the y-coordinate (top edge) of the available screen area. |
AvailWidth |
int |
get | Returns the amount of horizontal space in pixels available to the window. |
ColorDepth |
int |
get | Returns the color depth of the screen. |
Height |
int |
get | Returns the height of the screen in pixels. |
IsExtended |
bool |
get | Returns true if the user's device has multiple screens, and false if not. |
Orientation |
ScreenOrientation? |
get | Returns the ScreenOrientation instance associated with this screen. inconsistent browser support |
PixelDepth |
int |
get | Gets the bit depth of the screen. |
Width |
int |
get | Returns the width of the screen. |
| Event | Type | Description |
|---|---|---|
OnChange |
ActionEvent<Event> |
Fired on a specific screen when it changes in some way - width or height, available width or height, color depth, or orientation. |
OnOrientationChange |
ActionEvent<Event> |
Fires when the screen orientation changes. |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<Screen>(...)or constructornew Screen(...)
if (screen.colorDepth < 8) {
// use low-color version of page
} else {
// use regular, colorful page
}