// Type definitions for Neutralino 6.1.0 // Project: https://github.com/neutralinojs // Definitions project: https://github.com/neutralinojs/neutralino.js declare namespace Neutralino { namespace filesystem { interface DirectoryEntry { entry: string; path: string; type: string; } interface FileReaderOptions { pos: number; size: number; } interface DirectoryReaderOptions { recursive: boolean; } interface OpenedFile { id: number; eof: boolean; pos: number; lastRead: number; } interface Stats { size: number; isFile: boolean; isDirectory: boolean; createdAt: number; modifiedAt: number; } interface Watcher { id: number; path: string; } interface CopyOptions { recursive: boolean; overwrite: boolean; skip: boolean; } interface PathParts { rootName: string; rootDirectory: string; rootPath: string; relativePath: string; parentPath: string; filename: string; stem: string; extension: string; } interface Permissions { all: boolean; ownerAll: boolean; ownerRead: boolean; ownerWrite: boolean; ownerExec: boolean; groupAll: boolean; groupRead: boolean; groupWrite: boolean; groupExec: boolean; othersAll: boolean; othersRead: boolean; othersWrite: boolean; othersExec: boolean; } type PermissionsMode = "ADD" | "REPLACE" | "REMOVE"; function createDirectory(path: string): Promise; function remove(path: string): Promise; function writeFile(path: string, data: string): Promise; function appendFile(path: string, data: string): Promise; function writeBinaryFile(path: string, data: ArrayBuffer): Promise; function appendBinaryFile(path: string, data: ArrayBuffer): Promise; function readFile(path: string, options?: FileReaderOptions): Promise; function readBinaryFile(path: string, options?: FileReaderOptions): Promise; function openFile(path: string): Promise; function createWatcher(path: string): Promise; function removeWatcher(id: number): Promise; function getWatchers(): Promise; function updateOpenedFile(id: number, event: string, data?: any): Promise; function getOpenedFileInfo(id: number): Promise; function readDirectory(path: string, options?: DirectoryReaderOptions): Promise; function copy(source: string, destination: string, options?: CopyOptions): Promise; function move(source: string, destination: string): Promise; function getStats(path: string): Promise; function getAbsolutePath(path: string): Promise; function getRelativePath(path: string, base?: string): Promise; function getPathParts(path: string): Promise; function getPermissions(path: string): Promise; function setPermissions(path: string, permissions: Permissions, mode: PermissionsMode): Promise; } namespace os { // debug enum LoggerType { WARNING = "WARNING", ERROR = "ERROR", INFO = "INFO" } // os enum Icon { WARNING = "WARNING", ERROR = "ERROR", INFO = "INFO", QUESTION = "QUESTION" } enum MessageBoxChoice { OK = "OK", OK_CANCEL = "OK_CANCEL", YES_NO = "YES_NO", YES_NO_CANCEL = "YES_NO_CANCEL", RETRY_CANCEL = "RETRY_CANCEL", ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE" } //clipboard enum ClipboardFormat { unknown = "unknown", text = "text", image = "image" } // NL_GLOBALS enum Mode { window = "window", browser = "browser", cloud = "cloud", chrome = "chrome" } enum OperatingSystem { Linux = "Linux", Windows = "Windows", Darwin = "Darwin", FreeBSD = "FreeBSD", Unknown = "Unknown" } enum Architecture { x64 = "x64", arm = "arm", itanium = "itanium", ia32 = "ia32", unknown = "unknown" } interface ExecCommandOptions { stdIn?: string; background?: boolean; cwd?: string; } interface ExecCommandResult { pid: number; stdOut: string; stdErr: string; exitCode: number; } interface SpawnedProcess { id: number; pid: number; } interface SpawnedProcessOptions { cwd?: string; envs?: Record; } interface Envs { [key: string]: string; } interface OpenDialogOptions { multiSelections?: boolean; filters?: Filter[]; defaultPath?: string; } interface FolderDialogOptions { defaultPath?: string; } interface SaveDialogOptions { forceOverwrite?: boolean; filters?: Filter[]; defaultPath?: string; } interface Filter { name: string; extensions: string[]; } interface TrayOptions { icon: string; menuItems: TrayMenuItem[]; } interface TrayMenuItem { id?: string; text: string; isDisabled?: boolean; isChecked?: boolean; } type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2" | "temp"; function execCommand(command: string, options?: ExecCommandOptions): Promise; function spawnProcess(command: string, options?: SpawnedProcessOptions): Promise; function updateSpawnedProcess(id: number, event: string, data?: any): Promise; function getSpawnedProcesses(): Promise; function getEnv(key: string): Promise; function getEnvs(): Promise; function showOpenDialog(title?: string, options?: OpenDialogOptions): Promise; function showFolderDialog(title?: string, options?: FolderDialogOptions): Promise; function showSaveDialog(title?: string, options?: SaveDialogOptions): Promise; function showNotification(title: string, content: string, icon?: Icon): Promise; function showMessageBox(title: string, content: string, choice?: MessageBoxChoice, icon?: Icon): Promise; function setTray(options: TrayOptions): Promise; function open(url: string): Promise; function getPath(name: KnownPath): Promise; } namespace computer { interface MemoryInfo { physical: { total: number; available: number; }; virtual: { total: number; available: number; }; } interface KernelInfo { variant: string; version: string; } interface OSInfo { name: string; description: string; version: string; } interface CPUInfo { vendor: string; model: string; frequency: number; architecture: string; logicalThreads: number; physicalCores: number; physicalUnits: number; } interface Display { id: number; resolution: Resolution; dpi: number; bpp: number; refreshRate: number; } interface Resolution { width: number; height: number; } interface MousePosition { x: number; y: number; } function getMemoryInfo(): Promise; function getArch(): Promise; function getKernelInfo(): Promise; function getOSInfo(): Promise; function getCPUInfo(): Promise; function getDisplays(): Promise; function getMousePosition(): Promise; } namespace storage { function setData(key: string, data: string): Promise; function getData(key: string): Promise; function getKeys(): Promise; } namespace debug { // debug enum LoggerType { WARNING = "WARNING", ERROR = "ERROR", INFO = "INFO" } // os enum Icon { WARNING = "WARNING", ERROR = "ERROR", INFO = "INFO", QUESTION = "QUESTION" } enum MessageBoxChoice { OK = "OK", OK_CANCEL = "OK_CANCEL", YES_NO = "YES_NO", YES_NO_CANCEL = "YES_NO_CANCEL", RETRY_CANCEL = "RETRY_CANCEL", ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE" } //clipboard enum ClipboardFormat { unknown = "unknown", text = "text", image = "image" } // NL_GLOBALS enum Mode { window = "window", browser = "browser", cloud = "cloud", chrome = "chrome" } enum OperatingSystem { Linux = "Linux", Windows = "Windows", Darwin = "Darwin", FreeBSD = "FreeBSD", Unknown = "Unknown" } enum Architecture { x64 = "x64", arm = "arm", itanium = "itanium", ia32 = "ia32", unknown = "unknown" } function log(message: string, type?: LoggerType): Promise; } namespace app { interface OpenActionOptions { url: string; } interface RestartOptions { args: string; } function exit(code?: number): Promise; function killProcess(): Promise; function restartProcess(options?: RestartOptions): Promise; function getConfig(): Promise; function broadcast(event: string, data?: any): Promise; function readProcessInput(readAll?: boolean): Promise; function writeProcessOutput(data: string): Promise; function writeProcessError(data: string): Promise; } namespace window { interface WindowOptions extends WindowSizeOptions, WindowPosOptions { title?: string; icon?: string; fullScreen?: boolean; alwaysOnTop?: boolean; enableInspector?: boolean; borderless?: boolean; maximize?: boolean; hidden?: boolean; maximizable?: boolean; useSavedState?: boolean; exitProcessOnClose?: boolean; extendUserAgentWith?: string; injectGlobals?: boolean; injectClientLibrary?: boolean; injectScript?: string; processArgs?: string; } interface WindowSizeOptions { width?: number; height?: number; minWidth?: number; minHeight?: number; maxWidth?: number; maxHeight?: number; resizable?: boolean; } interface WindowPosOptions { x: number; y: number; } interface WindowMenu extends Array { } interface WindowMenuItem { id?: string; text: string; isDisabled?: boolean; isChecked?: boolean; menuItems?: WindowMenuItem[]; } function setTitle(title: string): Promise; function getTitle(): Promise; function maximize(): Promise; function unmaximize(): Promise; function isMaximized(): Promise; function minimize(): Promise; function unminimize(): Promise; function isMinimized(): Promise; function setFullScreen(): Promise; function exitFullScreen(): Promise; function isFullScreen(): Promise; function show(): Promise; function hide(): Promise; function isVisible(): Promise; function focus(): Promise; function setIcon(icon: string): Promise; function move(x: number, y: number): Promise; function center(): Promise; type DraggableRegionOptions = { /** * If set to `true`, the region will always capture the pointer, * ensuring dragging doesn't break on fast pointer movement. * Note that it prevents child elements from receiving any pointer events. * Defaults to `false`. */ alwaysCapture?: boolean; /** * Minimum distance between cursor's starting and current position * after which dragging is started. This helps prevent accidental dragging * while interacting with child elements. * Defaults to `10`. (In pixels.) */ dragMinDistance?: number; }; function setDraggableRegion(domElementOrId: string | HTMLElement, options?: DraggableRegionOptions): Promise<{ success: true; message: string; }>; function unsetDraggableRegion(domElementOrId: string | HTMLElement): Promise<{ success: true; message: string; }>; function setSize(options: WindowSizeOptions): Promise; function getSize(): Promise; function getPosition(): Promise; function setAlwaysOnTop(onTop: boolean): Promise; function create(url: string, options?: WindowOptions): Promise; function snapshot(path: string): Promise; function setMainMenu(options: WindowMenu): Promise; } namespace events { interface Response { success: boolean; message: string; } type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp"; function on(event: string, handler: (ev: CustomEvent) => void): Promise; function off(event: string, handler: (ev: CustomEvent) => void): Promise; function dispatch(event: string, data?: any): Promise; function broadcast(event: string, data?: any): Promise; } namespace extensions { interface ExtensionStats { loaded: string[]; connected: string[]; } function dispatch(extensionId: string, event: string, data?: any): Promise; function broadcast(event: string, data?: any): Promise; function getStats(): Promise; } namespace updater { interface Manifest { applicationId: string; version: string; resourcesURL: string; } function checkForUpdates(url: string): Promise; function install(): Promise; } namespace clipboard { interface ClipboardImage { width: number; height: number; bpp: number; bpr: number; redMask: number; greenMask: number; blueMask: number; redShift: number; greenShift: number; blueShift: number; data: ArrayBuffer; } // debug enum LoggerType { WARNING = "WARNING", ERROR = "ERROR", INFO = "INFO" } // os enum Icon { WARNING = "WARNING", ERROR = "ERROR", INFO = "INFO", QUESTION = "QUESTION" } enum MessageBoxChoice { OK = "OK", OK_CANCEL = "OK_CANCEL", YES_NO = "YES_NO", YES_NO_CANCEL = "YES_NO_CANCEL", RETRY_CANCEL = "RETRY_CANCEL", ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE" } //clipboard enum ClipboardFormat { unknown = "unknown", text = "text", image = "image" } // NL_GLOBALS enum Mode { window = "window", browser = "browser", cloud = "cloud", chrome = "chrome" } enum OperatingSystem { Linux = "Linux", Windows = "Windows", Darwin = "Darwin", FreeBSD = "FreeBSD", Unknown = "Unknown" } enum Architecture { x64 = "x64", arm = "arm", itanium = "itanium", ia32 = "ia32", unknown = "unknown" } function getFormat(): Promise; function readText(): Promise; function readImage(format?: string): Promise; function writeText(data: string): Promise; function writeImage(image: ClipboardImage): Promise; function readHTML(): Promise; function writeHTML(data: string): Promise; function clear(): Promise; } namespace resources { interface Stats { size: number; isFile: boolean; isDirectory: boolean; } function getFiles(): Promise; function getStats(path: string): Promise; function extractFile(path: string, destination: string): Promise; function extractDirectory(path: string, destination: string): Promise; function readFile(path: string): Promise; function readBinaryFile(path: string): Promise; } namespace server { function mount(path: string, target: string): Promise; function unmount(path: string): Promise; function getMounts(): Promise; } namespace custom { function getMethods(): Promise; } interface InitOptions { exportCustomMethods?: boolean; } function init(options?: InitOptions): void; type ErrorCode = "NE_FS_DIRCRER" | "NE_FS_RMDIRER" | "NE_FS_FILRDER" | "NE_FS_FILWRER" | "NE_FS_FILRMER" | "NE_FS_NOPATHE" | "NE_FS_COPYFER" | "NE_FS_MOVEFER" | "NE_OS_INVMSGA" | "NE_OS_INVKNPT" | "NE_ST_INVSTKY" | "NE_ST_STKEYWE" | "NE_RT_INVTOKN" | "NE_RT_NATPRME" | "NE_RT_APIPRME" | "NE_RT_NATRTER" | "NE_RT_NATNTIM" | "NE_CL_NSEROFF" | "NE_EX_EXTNOTC" | "NE_UP_CUPDMER" | "NE_UP_CUPDERR" | "NE_UP_UPDNOUF" | "NE_UP_UPDINER"; interface Error { code: ErrorCode; message: string; } interface OpenActionOptions { url: string; } interface RestartOptions { args: string; } interface MemoryInfo { physical: { total: number; available: number; }; virtual: { total: number; available: number; }; } interface KernelInfo { variant: string; version: string; } interface OSInfo { name: string; description: string; version: string; } interface CPUInfo { vendor: string; model: string; frequency: number; architecture: string; logicalThreads: number; physicalCores: number; physicalUnits: number; } interface Display { id: number; resolution: Resolution; dpi: number; bpp: number; refreshRate: number; } interface Resolution { width: number; height: number; } interface MousePosition { x: number; y: number; } interface ClipboardImage { width: number; height: number; bpp: number; bpr: number; redMask: number; greenMask: number; blueMask: number; redShift: number; greenShift: number; blueShift: number; data: ArrayBuffer; } interface ExtensionStats { loaded: string[]; connected: string[]; } interface DirectoryEntry { entry: string; path: string; type: string; } interface FileReaderOptions { pos: number; size: number; } interface DirectoryReaderOptions { recursive: boolean; } interface OpenedFile { id: number; eof: boolean; pos: number; lastRead: number; } interface Stats { size: number; isFile: boolean; isDirectory: boolean; createdAt: number; modifiedAt: number; } interface Watcher { id: number; path: string; } interface CopyOptions { recursive: boolean; overwrite: boolean; skip: boolean; } interface PathParts { rootName: string; rootDirectory: string; rootPath: string; relativePath: string; parentPath: string; filename: string; stem: string; extension: string; } interface Permissions { all: boolean; ownerAll: boolean; ownerRead: boolean; ownerWrite: boolean; ownerExec: boolean; groupAll: boolean; groupRead: boolean; groupWrite: boolean; groupExec: boolean; othersAll: boolean; othersRead: boolean; othersWrite: boolean; othersExec: boolean; } type PermissionsMode = "ADD" | "REPLACE" | "REMOVE"; interface ExecCommandOptions { stdIn?: string; background?: boolean; cwd?: string; } interface ExecCommandResult { pid: number; stdOut: string; stdErr: string; exitCode: number; } interface SpawnedProcess { id: number; pid: number; } interface SpawnedProcessOptions { cwd?: string; envs?: Record; } interface Envs { [key: string]: string; } interface OpenDialogOptions { multiSelections?: boolean; filters?: Filter[]; defaultPath?: string; } interface FolderDialogOptions { defaultPath?: string; } interface SaveDialogOptions { forceOverwrite?: boolean; filters?: Filter[]; defaultPath?: string; } interface Filter { name: string; extensions: string[]; } interface TrayOptions { icon: string; menuItems: TrayMenuItem[]; } interface TrayMenuItem { id?: string; text: string; isDisabled?: boolean; isChecked?: boolean; } type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2" | "temp"; interface Manifest { applicationId: string; version: string; resourcesURL: string; } interface WindowOptions extends WindowSizeOptions, WindowPosOptions { title?: string; icon?: string; fullScreen?: boolean; alwaysOnTop?: boolean; enableInspector?: boolean; borderless?: boolean; maximize?: boolean; hidden?: boolean; maximizable?: boolean; useSavedState?: boolean; exitProcessOnClose?: boolean; extendUserAgentWith?: string; injectGlobals?: boolean; injectClientLibrary?: boolean; injectScript?: string; processArgs?: string; } interface WindowSizeOptions { width?: number; height?: number; minWidth?: number; minHeight?: number; maxWidth?: number; maxHeight?: number; resizable?: boolean; } interface WindowPosOptions { x: number; y: number; } interface WindowMenu extends Array { } interface WindowMenuItem { id?: string; text: string; isDisabled?: boolean; isChecked?: boolean; menuItems?: WindowMenuItem[]; } interface Response { success: boolean; message: string; } type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp"; } // debug enum LoggerType { WARNING = 'WARNING', ERROR = 'ERROR', INFO = 'INFO' } // os enum Icon { WARNING = 'WARNING', ERROR = 'ERROR', INFO = 'INFO', QUESTION = 'QUESTION' } enum MessageBoxChoice { OK = 'OK', OK_CANCEL = 'OK_CANCEL', YES_NO = 'YES_NO', YES_NO_CANCEL = 'YES_NO_CANCEL', RETRY_CANCEL = 'RETRY_CANCEL', ABORT_RETRY_IGNORE = 'ABORT_RETRY_IGNORE' } //clipboard enum ClipboardFormat { unknown = 'unknown', text = 'text', image = 'image' } // NL_GLOBALS enum Mode { window = 'window', browser = 'browser', cloud = 'cloud', chrome = 'chrome' } enum OperatingSystem { Linux = 'Linux', Windows = 'Windows', Darwin = 'Darwin', FreeBSD = 'FreeBSD', Unknown = 'Unknown' } enum Architecture { x64 = 'x64', arm = 'arm', itanium = 'itanium', ia32 = 'ia32', unknown = 'unknown' } interface Response { success: boolean; message: string; } type Builtin = 'ready' | 'trayMenuItemClicked' | 'windowClose' | 'serverOffline' | 'clientConnect' | 'clientDisconnect' | 'appClientConnect' | 'appClientDisconnect' | 'extClientConnect' | 'extClientDisconnect' | 'extensionReady' | 'neuDev_reloadApp' // --- globals --- /** Mode of the application: window, browser, cloud, or chrome */ declare const NL_MODE: Mode; /** Application port */ declare const NL_PORT: number; /** Command-line arguments */ declare const NL_ARGS: string[]; /** Basic authentication token */ declare const NL_TOKEN: string; /** Neutralinojs client version */ declare const NL_CVERSION: string; /** Application identifier */ declare const NL_APPID: string; /** Application version */ declare const NL_APPVERSION: string; /** Application path */ declare const NL_PATH: string; /** Application data path */ declare const NL_DATAPATH: string; /** Returns true if extensions are enabled */ declare const NL_EXTENABLED: boolean; /** Returns true if the client library is injected */ declare const NL_GINJECTED: boolean; /** Returns true if globals are injected */ declare const NL_CINJECTED: boolean; /** Operating system name: Linux, Windows, Darwin, FreeBSD, or Uknown */ declare const NL_OS: OperatingSystem; /** CPU architecture: x64, arm, itanium, ia32, or unknown */ declare const NL_ARCH: Architecture; /** Neutralinojs server version */ declare const NL_VERSION: string; /** Current working directory */ declare const NL_CWD: string; /** Identifier of the current process */ declare const NL_PID: string; /** Source of application resources: bundle or directory */ declare const NL_RESMODE: string; /** Release commit of the client library */ declare const NL_CCOMMIT: string; /** An array of custom methods */ declare const NL_CMETHODS: string[];