Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dwm/src/core/mod.ts>Platform

Deno Window Manager: Cross-platform window creation and management
Go to Latest
interface Platform
import { type Platform } from "https://deno.land/x/dwm@0.2.0/src/core/mod.ts";

Properties

readonly
Window: { new (options: CreateWindowOptions): DwmWindow; } & DwmWindow

Platform's window class

readonly
Monitor: DwmMonitor

Platform's monitor class

Methods

getMonitors(): DwmMonitor[]

Gets list of monitors.

getPrimaryMonitor(): DwmMonitor

Gets primary monitor.

pollEvents(wait?: boolean): void

Poll events.

getProcAddress(name: string): Deno.PointerValue

Gets the address of the given process

mainloop(
cb?: (hrtime: number) => unknown,
loop?: boolean,
wait?: boolean,
): Promise<never>

Starts the main loop. Never returns. Program's lifecycle is then managed by this. Once the function has to return (i.e. the UI event loop has stopped), it will exit the process.

It handles polling events by itself. If you want to make manual program loop, use pollEvents instead.

Loop parameter specifies whether the loop should be blocking or not. Blocking loop is fast, but it will block any async operations happening outside the given callback function. It is recommended to use loop: true (which is default) because it is faster and suitable for most use cases.

Wait option specifies whether the loop should wait for a new event before returning control to the callback function. It is recommended to use wait: false (default) for applications like games which render continuously. However wait: true is suitable for interactive UI applications which don't need to render continuously. It also reduces CPU usage.

vulkanSupported(): boolean

Whether Vulkan API is supported.

getRequiredInstanceExtensions(): string[]

Gets the required instance extensions for Vulkan.

getInstanceProcAddress(instance: Deno.PointerValue, name: string): Deno.PointerValue

Gets the address of the given instance function.

getPhysicalDevicePresentationSupport(
queueFamily: number,
): boolean

Gets whether the physical device supports presentation.