Desktop
Provides access to the desktop environment.
import { desktop } from '@mobrowser/api';
Example
import { desktop } from '@mobrowser/api';
desktop.openUrl('https://example.com')
desktop.showPath('/Users/john/Desktop')
Methods
openUrl()
openUrl(url: string): void;
Opens the given URL in the associated application.
If the given URL is a website, the default web browser will be launched to open it.
If the given URL is a mailto: URL, the default mail client will be launched to
compose a new message.
| Parameter | Type | Description |
|---|---|---|
url | string | The URL of the website or a mailto: URL to open. |
openPath()
openPath(path: FilePath): void;
Opens the given path in the associated application.
If the associated application is not launched yet, it will be launched. If the given path is a directory, the file manager of the current platform is launched to show it.
| Parameter | Type | Description |
|---|---|---|
path | FilePath | The absolute or relative path to the file or directory to open. |
showPath()
showPath(path: FilePath): void;
Shows the given path in the file manager of the current platform.
If the given path is a file/directory the file manager will open its containing directory and try selecting the file/directory.
If you need to show content of a directory, use openPath(path) with the directory path.
| Parameter | Type | Description |
|---|---|---|
path | FilePath | The absolute or relative path to the file or directory to show. |