目录

LaunchInfo

Contains information about the application launch, such as whether it is the first run and the version of the application that was last launched.

import { LaunchInfo } from '@mobrowser/api';

Example 

import { app, LaunchInfo } from '@mobrowser/api';

const launchInfo: LaunchInfo = app.launchInfo
if (launchInfo.isFirstRun) {
  console.log('Welcome! First time launch.')
} else {
  console.log('Last used version:', launchInfo.lastLaunchedVersion)
}

Properties 

isFirstRun 

readonly isFirstRun: boolean;

Indicates whether this is the first time the application has been launched.

lastLaunchedVersion 

readonly lastLaunchedVersion: string;

The version of the application that was last launched, or an empty string if this is the first run.

files 

readonly files: readonly string[];

The files the operating system asked the app to open as it launched — a double-clicked associated file, an “Open with” choice, or paths given on the command line. Empty for a plain launch.

Populated before the main script runs, so it can be read synchronously to decide whether to have the default app launch or, for example, open a file in an editor instead. Files that arrive after startup are delivered to app.handle('openFile', ...) instead and never appear here.

Usually holds at most one path: macOS delivers a multi-selection one file per event and Windows starts one process per file, so only the first is known by the time the script runs and the rest reach the handler. A Linux %U activation or a command line can name several at once.

Example 

import { app } from '@mobrowser/api';

if (app.launchInfo.files.length > 0) {
  app.launchInfo.files.forEach(openFileEditor)
} else {
  showMainWindow()
}

url 

readonly url: string;

The custom-scheme URL the operating system asked the app to open as it launched, or an empty string for a plain launch.

Populated before the main script runs, so it can be read synchronously. URLs that arrive after startup are delivered to app.handle('openUrl', ...) instead and never appear here.