Constructor
new SypnexAPI(appId, helpers)
Create a new SypnexAPI instance
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
appId | string | Unique identifier for the application | ||||||||||||||||
helpers | object | Helper functions provided by the OS environmentProperties
|
- Source
Members
scaling :object
Access to scaling utilities
Type:
- object
- Source
Methods
_triggerEvent(eventName, data)
Trigger internal events (for app communication)
Parameters:
Name | Type | Description |
---|---|---|
eventName | string | Event name |
data | any | Event data |
- Source
appToScreenCoords(appX, appY, zoomScaleopt) → {object}
Convenience method: Convert app to screen coordinates
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
appX | number | App X coordinate | ||
appY | number | App Y coordinate | ||
zoomScale | number | <optional> | 1.0 | Optional zoom scale |
- Source
Returns:
Screen coordinates
- Type:
- object
cleanup()
Internal method called by the OS during app cleanup Executes all registered cleanup hooks
- Source
clearLogs(filtersopt) → {Promise.<object>}
Clear logs with optional filtering
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filters | object | <optional> | Filter optionsProperties
|
- Source
Returns:
- Clear operation result
- Type:
- Promise.<object>
connectSocket(url, options) → {Promise.<boolean>}
Connect to Socket.IO server for this app instance
Parameters:
Name | Type | Description |
---|---|---|
url | string | Socket.IO server URL (defaults to current origin) |
options | object | Socket.IO connection options |
- Source
Returns:
- Connection success status
- Type:
- Promise.<boolean>
createHamburgerMenu(container, menuItems, optionsopt) → {object}
Create a hamburger menu with customizable items
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
container | HTMLElement | The container element to append the menu to | ||||||||||||||||||||||
menuItems | Array | Array of menu item objects | ||||||||||||||||||||||
options | object | <optional> | {} | Configuration optionsProperties
|
- Source
Returns:
Object with methods to control the menu
- Type:
- object
Example
const menuItems = [
{ icon: 'fas fa-sync-alt', text: 'Refresh', action: () => console.log('Refresh') },
{ icon: 'fas fa-folder-plus', text: 'New Folder', action: () => console.log('New Folder') },
{ type: 'separator' },
{ icon: 'fas fa-upload', text: 'Upload File', action: () => console.log('Upload') }
];
const menu = sypnexAPI.createHamburgerMenu(container, menuItems, { position: 'right' });
createVirtualDirectoryStructure(dirPath) → {Promise.<object>}
Create a directory structure (creates parent directories if needed)
Parameters:
Name | Type | Description |
---|---|---|
dirPath | string | Directory path to create |
- Source
Returns:
- Creation result
- Type:
- Promise.<object>
createVirtualFile(name, content, parentPath) → {Promise.<object>}
Create a new file
Parameters:
Name | Type | Description |
---|---|---|
name | string | File name |
content | string | File content |
parentPath | string | Parent directory path (defaults to '/') |
- Source
Returns:
- Creation result
- Type:
- Promise.<object>
createVirtualFolder(name, parentPath) → {Promise.<object>}
Create a new folder
Parameters:
Name | Type | Description |
---|---|---|
name | string | Folder name |
parentPath | string | Parent directory path (defaults to '/') |
- Source
Returns:
- Creation result
- Type:
- Promise.<object>
decrypt(encryptedValue) → {Promise.<(string|null)>}
Decrypt a value that was previously encrypted with the encrypt() method
Parameters:
Name | Type | Description |
---|---|---|
encryptedValue | string | The encrypted value to decrypt |
- Source
Returns:
The decrypted value, or null if decryption failed
- Type:
- Promise.<(string|null)>
Example
// Decrypt a previously encrypted value
const decrypted = await sypnexAPI.decrypt(encryptedValue);
// Handle decryption failure
if (decrypted === null) {
console.error("Failed to decrypt value");
}
(async) deleteSetting(key) → {Promise.<boolean>}
Delete an application setting
Parameters:
Name | Type | Description |
---|---|---|
key | string | Setting key to delete |
- Source
Returns:
True if deleted successfully, false otherwise
- Type:
- Promise.<boolean>
deleteVirtualItem(itemPath) → {Promise.<object>}
Delete a file or directory
Parameters:
Name | Type | Description |
---|---|---|
itemPath | string | Path to the item to delete |
- Source
Returns:
- Deletion result
- Type:
- Promise.<object>
detectAppScale() → {number}
Convenience method: Detect current app scale
- Source
Returns:
Scale factor
- Type:
- number
encrypt(value) → {Promise.<(string|null)>}
Encrypt a value using the system's encryption service
Parameters:
Name | Type | Description |
---|---|---|
value | string | | The value to encrypt (will be JSON.stringify'd if object) |
- Source
Returns:
The encrypted value as a string, or null if encryption failed
- Type:
- Promise.<(string|null)>
Example
// Encrypt a simple string
const encrypted = await sypnexAPI.encrypt("my secret data");
// Encrypt an object
const encryptedObj = await sypnexAPI.encrypt({username: "john", password: "secret"});
eventToKeyString(event) → {string}
Convert keyboard event to standardized key string
Parameters:
Name | Type | Description |
---|---|---|
event | KeyboardEvent | The keyboard event |
- Source
Returns:
Standardized key string
- Type:
- string
(async) getAllSettings() → {Promise.<object>}
Get all application settings
- Source
Returns:
Object containing all app settings
- Type:
- Promise.<object>
getAppId() → {string}
Get the application ID
- Source
Returns:
The application identifier
- Type:
- string
(async) getAppMetadata() → {Promise.<(object|null)>}
Get metadata for this application
- Source
Returns:
Application metadata or null if error
- Type:
- Promise.<(object|null)>
getAppWindow() → {Object}
Get the isolated window object for this app with automatic property tracking Returns the same window proxy instance for subsequent calls (singleton pattern). All properties assigned to this window proxy will be automatically cleaned up when the app is closed, preventing memory leaks and conflicts.
- Source
Returns:
Window proxy object that tracks property assignments
- Type:
- Object
Example
// Instead of: window.myData = { ... }
// Use:
const appWindow = sypnexAPI.getAppWindow();
appWindow.myData = { ... }; // This will be automatically cleaned up
// Multiple calls return the same proxy:
const w1 = sypnexAPI.getAppWindow();
const w2 = sypnexAPI.getAppWindow();
console.log(w1 === w2); // true
// The proxy behaves exactly like window for reading:
appWindow.document.getElementById('myId'); // Works normally
appWindow.localStorage.getItem('key'); // Works normally
(async) getAvailableApps() → {Promise.<object>}
Get available applications from the registry
- Source
Returns:
- Available applications data
- Type:
- Promise.<object>
(async) getInstalledApps() → {Promise.<Array>}
Get list of installed applications
- Source
Returns:
- Array of installed applications
- Type:
- Promise.<Array>
getKeyboardStats() → {object}
Get keyboard shortcut statistics
- Source
Returns:
Statistics about registered shortcuts
- Type:
- object
getLogDates() → {Promise.<object>}
Get available log dates for each component
- Source
Returns:
- Available dates by component
- Type:
- Promise.<object>
getLogStats() → {Promise.<object>}
Get logging system statistics
- Source
Returns:
- Logging statistics
- Type:
- Promise.<object>
getMyLogs(filtersopt) → {Promise.<object>}
Get logs for the current app (convenience method)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filters | object | <optional> | Additional filter options |
- Source
Returns:
- Log entries for this app
- Type:
- Promise.<object>
(async) getPreference(category, key, defaultValueopt) → {Promise.<*>}
Get a user preference value
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
category | string | Preference category | ||
key | string | Preference key | ||
defaultValue | * | <optional> | null | Default value if preference not found |
- Source
Returns:
The preference value or default value
- Type:
- Promise.<*>
getScaledBoundingClientRect(element) → {object}
Convenience method: Get scaled element bounds
Parameters:
Name | Type | Description |
---|---|---|
element | Element | DOM element |
- Source
Returns:
Scaled bounding rectangle
- Type:
- object
getScaledMouseCoords(e) → {object}
Convenience method: Get scaled mouse coordinates
Parameters:
Name | Type | Description |
---|---|---|
e | Event | Mouse event |
- Source
Returns:
Scaled coordinates
- Type:
- object
(async) getServices() → {Promise.<Array>}
Get a list of all available services
- Source
Throws:
- If the request fails
- Type
- Error
Returns:
Array of service objects
- Type:
- Promise.<Array>
Example
const services = await sypnexAPI.getServices();
console.log(services); // [{ id: "service1", name: "Service 1", running: true }, ...]
(async) getSetting(key, defaultValueopt) → {Promise.<*>}
Get an application setting
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key | string | Setting key to retrieve | ||
defaultValue | * | <optional> | null | Default value if setting not found |
- Source
Returns:
The setting value or default value
- Type:
- Promise.<*>
getSocket() → {object|null}
Get the Socket.IO instance
- Source
Returns:
- Socket.IO instance or null
- Type:
- object |
null
getSocketState() → {object}
Get Socket.IO connection state
- Source
Returns:
- Connection state object
- Type:
- object
getStats() → {object}
Get statistics about registered shortcuts
- Source
Returns:
Statistics object
- Type:
- object
getSypnexApps() → {Object}
Get access to the global SypnexApps tracker
- Source
Returns:
- The window.sypnexApps object containing app tracking info
- Type:
- Object
getSypnexOS() → {Object}
Get access to the global SypnexOS apps registry
- Source
Returns:
- The window.sypnexOS object containing apps Map and other OS functions
- Type:
- Object
getVirtualFileStats() → {Promise.<object>}
Get virtual file system statistics
- Source
Returns:
- System statistics
- Type:
- Promise.<object>
getVirtualFileUrl(filePath) → {string}
Serve a file directly (for binary files, images, etc.)
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
- Source
Returns:
- Direct URL to serve the file
- Type:
- string
getVirtualItemInfo(itemPath) → {Promise.<object>}
Get information about a file or directory
Parameters:
Name | Type | Description |
---|---|---|
itemPath | string | Path to the item |
- Source
Returns:
- Item information
- Type:
- Promise.<object>
(async) getWindowState() → {Promise.<(object|null)>}
Get the saved window state for this application
- Source
Returns:
Window state object or null if not found
- Type:
- Promise.<(object|null)>
(async) init() → {Promise.<void>}
Initialize the SypnexAPI instance Checks for required helper functions and sets up the API
- Source
Returns:
- Type:
- Promise.<void>
initScaleDetection(onScaleChangeopt) → {MutationObserver}
Convenience method: Initialize scale detection
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onScaleChange | function | <optional> | Callback for scale changes |
- Source
Returns:
Observer instance
- Type:
- MutationObserver
initializeWindowManager()
Initialize the window management system
- Source
(async) installApp(appId, optionsopt) → {Promise.<object>}
Install an application from the registry
Parameters:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
appId | string | Application ID to install | ||||||||||
options | object | <optional> | {} | Installation optionsProperties
|
- Source
Returns:
- Installation result
- Type:
- Promise.<object>
isInitialized() → {boolean}
Check if the SypnexAPI has been initialized
- Source
Returns:
True if initialized, false otherwise
- Type:
- boolean
isSocketConnected() → {boolean}
Check if Socket.IO is connected
- Source
Returns:
- Connection status
- Type:
- boolean
joinRoom(roomName) → {boolean}
Join a Socket.IO room
Parameters:
Name | Type | Description |
---|---|---|
roomName | string | Room to join |
- Source
Returns:
- Success status
- Type:
- boolean
leaveRoom(roomName) → {boolean}
Leave a Socket.IO room
Parameters:
Name | Type | Description |
---|---|---|
roomName | string | Room to leave |
- Source
Returns:
- Success status
- Type:
- boolean
listVirtualFiles(path) → {Promise.<object>}
List files and directories in a path
Parameters:
Name | Type | Description |
---|---|---|
path | string | Directory path (defaults to '/') |
- Source
Returns:
- Directory contents
- Type:
- Promise.<object>
(async) llmComplete(options) → {Promise.<object>}
Complete a chat conversation using any supported LLM provider Translates OpenAI format to provider-specific format and normalizes response
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | Configuration optionsProperties
|
- Source
Returns:
Normalized response: {content, usage, model, provider}
- Type:
- Promise.<object>
loadLibrary(url, options) → {Promise.<any>}
Load a library from CDN
Parameters:
Name | Type | Description |
---|---|---|
url | string | CDN URL of the library |
options | object | Loading options |
- Source
Returns:
- Loaded library or true if successful
- Type:
- Promise.<any>
logCritical(message, detailsopt) → {Promise.<object>}
Convenience method to write critical log
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message | string | Log message | |
details | object | <optional> | Additional details |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
logDebug(message, detailsopt) → {Promise.<object>}
Convenience method to write debug log
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message | string | Log message | |
details | object | <optional> | Additional details |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
logError(message, detailsopt) → {Promise.<object>}
Convenience method to write error log
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message | string | Log message | |
details | object | <optional> | Additional details |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
logInfo(message, detailsopt) → {Promise.<object>}
Convenience method to write info log
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message | string | Log message | |
details | object | <optional> | Additional details |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
logWarn(message, detailsopt) → {Promise.<object>}
Convenience method to write warning log
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message | string | Log message | |
details | object | <optional> | Additional details |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
off(eventName, callback)
Remove Socket.IO event listener
Parameters:
Name | Type | Description |
---|---|---|
eventName | string | Event name |
callback | function | Callback function to remove |
- Source
on(eventName, callback)
Listen for Socket.IO events
Parameters:
Name | Type | Description |
---|---|---|
eventName | string | Event name to listen for |
callback | function | Callback function |
- Source
onBeforeClose(cleanupFunction, descriptionopt)
Register a cleanup function to be called when the app is closed Use this for custom cleanup like stopping game loops, disposing WebGL contexts, etc.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cleanupFunction | function | Function to call during app cleanup | ||
description | string | <optional> | User cleanup | Optional description for debugging |
- Source
Example
// For Three.js apps
sypnexAPI.onBeforeClose(() => {
if (renderer) {
renderer.dispose();
renderer.domElement = null;
}
if (animationId) {
cancelAnimationFrame(animationId);
}
}, 'Three.js cleanup');
// For game loops
sypnexAPI.onBeforeClose(() => {
gameRunning = false;
if (gameLoopInterval) {
clearInterval(gameLoopInterval);
}
}, 'Game loop cleanup');
ping() → {Promise.<number>}
Send a ping to test connection
- Source
Returns:
- Ping time in milliseconds
- Type:
- Promise.<number>
(async) proxyDELETE(url, optionsopt) → {Promise.<object>}
Make a DELETE request through the proxy
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url | string | Target URL | |||||||||||||||||
options | object | <optional> | {} | Additional optionsProperties
|
- Source
Returns:
- Response data
- Type:
- Promise.<object>
(async) proxyGET(url, optionsopt) → {Promise.<object>}
Make a GET request through the proxy
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url | string | Target URL | |||||||||||||||||
options | object | <optional> | {} | Additional optionsProperties
|
- Source
Returns:
- Response data
- Type:
- Promise.<object>
(async) proxyHTTP(options) → {Promise.<object>}
Proxy an HTTP request through the system (tries direct CORS, falls back to proxy)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | HTTP request optionsProperties
|
- Source
Returns:
- Response data in proxy format for compatibility
- Type:
- Promise.<object>
(async) proxyJSON(url, optionsopt) → {Promise.<object>}
Make a JSON API request through the proxy
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url | string | Target URL | |||||||||||||||||||||||||||
options | object | <optional> | {} | Request optionsProperties
|
- Source
Returns:
- Parsed JSON response
- Type:
- Promise.<object>
(async) proxyPOST(url, body, optionsopt) → {Promise.<object>}
Make a POST request through the proxy
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url | string | Target URL | |||||||||||||||||
body | * | Request body | |||||||||||||||||
options | object | <optional> | {} | Additional optionsProperties
|
- Source
Returns:
- Response data
- Type:
- Promise.<object>
(async) proxyPUT(url, body, optionsopt) → {Promise.<object>}
Make a PUT request through the proxy
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url | string | Target URL | |||||||||||||||||
body | * | Request body | |||||||||||||||||
options | object | <optional> | {} | Additional optionsProperties
|
- Source
Returns:
- Response data
- Type:
- Promise.<object>
readLogs(filtersopt) → {Promise.<object>}
Read logs with filtering options
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filters | object | <optional> | Filter optionsProperties
|
- Source
Returns:
- Log entries and metadata
- Type:
- Promise.<object>
readVirtualFile(filePath) → {Promise.<object>}
Read a file's content
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
- Source
Returns:
- File data
- Type:
- Promise.<object>
readVirtualFileBlob(filePath) → {Promise.<Blob>}
Get a file's content as Blob (for binary files, images, etc.)
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
- Source
Returns:
- File content as Blob
- Type:
- Promise.<Blob>
readVirtualFileJSON(filePath) → {Promise.<object>}
Get a file's content as JSON
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
- Source
Returns:
- Parsed JSON content
- Type:
- Promise.<object>
readVirtualFileText(filePath) → {Promise.<string>}
Get a file's content as text
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
- Source
Returns:
- File content as text
- Type:
- Promise.<string>
(async) refreshAppRegistry() → {Promise.<object>}
Refresh the application registry cache
- Source
Returns:
- Refresh result
- Type:
- Promise.<object>
(async) refreshAppVersionsCache() → {Promise.<boolean>}
Request the OS to refresh the latest app versions cache Useful when an app knows it has been updated or wants to force a cache refresh
- Source
Returns:
True if refresh was successful, false otherwise
- Type:
- Promise.<boolean>
registerKeyboardShortcuts(shortcuts, config)
Register keyboard shortcuts for this application
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
shortcuts | object | Object mapping key strings to handler functions | |||||||||
config | object | Configuration optionsProperties
|
- Source
Example
this.registerKeyboardShortcuts({
'f': () => this.toggleFullscreen(),
'escape': () => this.exitFullscreen(),
'space': () => this.pausePlay(),
'ctrl+s': () => this.save()
});
removeCleanupHook(cleanupFunction)
Remove a previously registered cleanup function
Parameters:
Name | Type | Description |
---|---|---|
cleanupFunction | function | The function to remove |
- Source
(async) saveWindowState(state) → {Promise.<boolean>}
Save the window state for this application
Parameters:
Name | Type | Description |
---|---|---|
state | object | Window state object to save |
- Source
Returns:
True if saved successfully, false otherwise
- Type:
- Promise.<boolean>
screenToAppCoords(screenX, screenY, zoomScaleopt) → {object}
Convenience method: Convert screen to app coordinates
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
screenX | number | Screen X coordinate | ||
screenY | number | Screen Y coordinate | ||
zoomScale | number | <optional> | 1.0 | Optional zoom scale |
- Source
Returns:
App coordinates
- Type:
- object
sendMessage(event, data, room) → {boolean}
Send a message via Socket.IO
Parameters:
Name | Type | Description |
---|---|---|
event | string | Event name |
data | any | Data to send |
room | string | Room to send to (optional) |
- Source
Returns:
- Success status
- Type:
- boolean
setAutoReconnect(enabled)
Enable or disable auto-reconnect
Parameters:
Name | Type | Description |
---|---|---|
enabled | boolean | Whether to enable auto-reconnect |
- Source
setHealthCheckInterval(intervalMs)
Set health check interval
Parameters:
Name | Type | Description |
---|---|---|
intervalMs | number | Interval in milliseconds |
- Source
setHealthChecks(enabled)
Enable or disable health checks
Parameters:
Name | Type | Description |
---|---|---|
enabled | boolean | Whether to enable health checks |
- Source
(async) setPreference(category, key, value) → {Promise.<boolean>}
Set a user preference value
Parameters:
Name | Type | Description |
---|---|---|
category | string | Preference category |
key | string | Preference key |
value | * | Value to store |
- Source
Returns:
True if saved successfully, false otherwise
- Type:
- Promise.<boolean>
setReconnectConfig(config)
Set auto-reconnect configuration
Parameters:
Name | Type | Description |
---|---|---|
config | object | Reconnect configuration |
- Source
(async) setSetting(key, value) → {Promise.<boolean>}
Set an application setting
Parameters:
Name | Type | Description |
---|---|---|
key | string | Setting key to set |
value | * | Value to store |
- Source
Returns:
True if saved successfully, false otherwise
- Type:
- Promise.<boolean>
(async) showConfirmation(title, message, optionsopt) → {Promise.<boolean>}
Show a confirmation dialog with standard OS styling
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
title | string | Dialog title | |||||||||||||||||||||||||||
message | string | Dialog message | |||||||||||||||||||||||||||
options | object | <optional> | {} | Configuration optionsProperties
|
- Source
Returns:
True if confirmed, false if cancelled
- Type:
- Promise.<boolean>
showFileExplorer(options) → {Promise.<string>}
Show a file explorer modal for selecting files or directories
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | Configuration optionsProperties
|
- Source
Returns:
- Selected file path or null if cancelled
- Type:
- Promise.<string>
showFileUploadModal(title, message, optionsopt) → {Promise.<(File|null)>}
Show a file upload modal
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
title | string | Modal title | |||||||||||||||||||||||||||
message | string | Modal message/label | |||||||||||||||||||||||||||
options | object | <optional> | {} | Configuration optionsProperties
|
- Source
Returns:
Selected file if confirmed, null if cancelled
- Type:
- Promise.<(File|null)>
showInputModal(title, message, optionsopt) → {Promise.<(string|null)>}
Show an input modal for getting text input from user
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
title | string | Modal title | |||||||||||||||||||||||||||||||||||||
message | string | Modal message/label | |||||||||||||||||||||||||||||||||||||
options | object | <optional> | {} | Configuration optionsProperties
|
- Source
Returns:
Input value if confirmed, null if cancelled
- Type:
- Promise.<(string|null)>
(async) startService(serviceId) → {Promise.<void>}
Start a specific service by ID
Parameters:
Name | Type | Description |
---|---|---|
serviceId | string | The ID of the service to start |
- Source
Throws:
- If the request fails
- Type
- Error
Returns:
- Type:
- Promise.<void>
Example
await sypnexAPI.startService("my-service-id");
(async) stopService(serviceId) → {Promise.<void>}
Stop a specific service by ID
Parameters:
Name | Type | Description |
---|---|---|
serviceId | string | The ID of the service to stop |
- Source
Throws:
- If the request fails
- Type
- Error
Returns:
- Type:
- Promise.<void>
Example
await sypnexAPI.stopService("my-service-id");
(async) uninstallApp(appId) → {Promise.<object>}
Uninstall an application
Parameters:
Name | Type | Description |
---|---|---|
appId | string | Application ID to uninstall |
- Source
Returns:
- Uninstallation result
- Type:
- Promise.<object>
unregisterApp(appId)
Unregister all shortcuts for an application
Parameters:
Name | Type | Description |
---|---|---|
appId | string | Application identifier |
- Source
(async) updateApp(appId, downloadUrl) → {Promise.<object>}
Update a specific application to the latest version
Parameters:
Name | Type | Description |
---|---|---|
appId | string | Application ID to update |
downloadUrl | string | Download URL for the app update (required) |
- Source
Returns:
- Update result
- Type:
- Promise.<object>
uploadVirtualFile(file, parentPath) → {Promise.<object>}
Upload a file from the host system
Parameters:
Name | Type | Description |
---|---|---|
file | File | File object from input element |
parentPath | string | Parent directory path (defaults to '/') |
- Source
Returns:
- Upload result
- Type:
- Promise.<object>
uploadVirtualFileChunked(file, parentPath, progressCallback) → {Object}
Upload a file with real progress tracking based on actual upload progress
Parameters:
Name | Type | Description |
---|---|---|
file | File | File object from input element |
parentPath | string | Parent directory path (defaults to '/') |
progressCallback | function | Callback for progress updates (percent) |
- Source
Returns:
- Object with promise and abort method { promise: Promise
- Type:
- Object
virtualItemExists(itemPath) → {Promise.<boolean>}
Check if a file or directory exists
Parameters:
Name | Type | Description |
---|---|---|
itemPath | string | Path to the item |
- Source
Returns:
- Whether the item exists
- Type:
- Promise.<boolean>
writeLog(logData) → {Promise.<object>}
Write a log entry
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
logData | object | Log entry dataProperties
|
- Source
Returns:
- Write result
- Type:
- Promise.<object>
writeVirtualFile(filePath, content) → {Promise.<object>}
Write content to a file (creates or overwrites)
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
content | string | File content |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
writeVirtualFileBinary(filePath, binaryData) → {Promise.<object>}
Write binary content to a file using the upload endpoint
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
binaryData | Uint8Array | | Binary data to write |
- Source
Returns:
- Write result
- Type:
- Promise.<object>
writeVirtualFileJSON(filePath, data) → {Promise.<object>}
Write JSON content to a file
Parameters:
Name | Type | Description |
---|---|---|
filePath | string | Path to the file |
data | object | JSON data to write |
- Source
Returns:
- Write result
- Type:
- Promise.<object>