1. API
  2. platform.os

API

Functions

Function Description
openURL(url) Open a specified URL using the operating system's default URI handling system.Note: Due to sandboxing restrictions, the only supported schemes are http and https. Attempting to open any other URL scheme will result in the Promise rejecting.

openURL()

Open a specified URL using the operating system's default URI handling system.

Note: Due to sandboxing restrictions, the only supported schemes are http and https. Attempting to open any other URL scheme will result in the Promise rejecting.

Signature:

        import { platform } from "@todesktop/client-core"
platform.openURL(url: string): Promise<void>;

      
Parameters
Parameter Type Description
url string

Returns:

Promise<void>

Example

Opening Google in the user's default browser

        import { platform } from "@todesktop/client-core";

async function init() {
  const url = "https://google.com";
  await platform.os.openURL(url);
  console.log(`Successfully asked the OS to open URL ${url}`);
}

init()


      

Variables

getOSArch

Signature:

        getOSArch: () => ReturnType<typeof nodeArch>

      

getOSPlatform

Signature:

        getOSPlatform: () => ReturnType<typeof nodePlatform>

      

getOSRelease

Signature:

        getOSRelease: () => ReturnType<typeof nodeRelease>

      

getOSType

Signature:

        getOSType: () => ReturnType<typeof nodeType>