Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: Screen
Source: JSObjects/ScreenDetailed.cs
MDN Reference: ScreenDetailed on MDN
The ScreenDetailed interface of the Window Management API represents detailed information about one specific screen available to the user's device. https://developer.mozilla.org/en-US/docs/Web/API/ScreenDetailed
| Signature | Description |
|---|---|
ScreenDetailed(SpawnJSObjectReference _ref) |
Deserialization constructor |
| Property | Type | Access | Description |
|---|---|---|---|
DevicePixelRatio |
double |
get | A number representing the screen's device pixel ratio. |
IsInternal |
bool |
get/set | A boolean indicating whether the screen is internal to the device or external. |
IsPrimary |
bool |
get | A boolean indicating whether the screen is set as the operating system (OS) primary screen or not. |
Label |
string |
get | A string providing a descriptive label for the screen, for example "Built-in Retina Display". |
Left |
int |
get | A number representing the x-coordinate (left-hand edge) of the total screen area. |
Top |
int |
get | A number representing the y-coordinate (top edge) of the total screen area. |
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<ScreenDetailed>(...)or constructornew ScreenDetailed(...)
// Return ScreenDetails
const allScreens = await window.getScreenDetails();
// Return the primary screen ScreenDetailed object
const primaryScreenDetailed = allScreens.screens.find(
(screenDetailed) => screenDetailed.isPrimary,
);
// Open a window in the top-left corner of the OS primary screen
window.open(
"https://example.com",
"_blank",
`left=${primaryScreenDetailed.availLeft},
top=${primaryScreenDetailed.availTop},
width=200,
height=200`,
);