API Reference
Machine Code API
The packaging tool currently supports machine code API for implementing custom authentication logic.
You can call the following code anywhere in the webpage to get the user's machine code:
window.HTMLPackHelper.machineCode
Window Control APIs
Window Operations
window.HTMLPackHelper.maximize() // Maximize window
window.HTMLPackHelper.minimize() // Minimize window
window.HTMLPackHelper.restore() // Restore window size
window.HTMLPackHelper.close() // Close application
Fullscreen Control
window.HTMLPackHelper.toggleFullscreen() // Toggle fullscreen mode
Navigation
window.HTMLPackHelper.backToHomePage() // Return to homepage
File Operation APIs
Open Local Files
window.HTMLPackHelper.open(path) // path can be relative or absolute
// Examples:
window.HTMLPackHelper.open("C:/Windows/notepad.exe") // Open notepad
window.HTMLPackHelper.open("my.docx") // Open my.docx in exe directory
Debug Window
window.HTMLPackHelper.openDebug() // Open debug window
Storage APIs
Storage Management
window.HTMLPackHelper.getStorageSize() // Get current storage size in bytes
window.HTMLPackHelper.get(key) // Get data by key
window.HTMLPackHelper.set(key, value) // Set data with key and value
window.HTMLPackHelper.clear() // Clear all stored data
Clipboard API
window.HTMLPackHelper.getClipboardString() // Get clipboard text content
Window Effects
Flash Window
window.HTMLPackHelper.flashWindow() // Start flashing window
window.HTMLPackHelper.stopFlashWindow() // Stop flashing window
System APIs
Cache Management
window.HTMLPackHelper.clearAllCache() // Clear all cache
System Control
window.HTMLPackHelper.shutdownSystem() // Shutdown computer
Hardware Info
window.HTMLPackHelper.getUniqueMachineCode() // Get unique machine code
window.HTMLPackHelper.getMac() // Get MAC address (returns format: 0b:00:28:00:00:0c)
Browser Integration
window.HTMLPackHelper.openUrlInBrowser("https://example.com") // Open URL in default browser
Exit Handler
window.HTMLPackHelper.onQuit = () => {
// Your business logic
// return false: prevent closing
// return true: allow closing
return false;
}
Serial Port Communication
const SerialPort = HTMLPackHelper.getSerialPort().SerialPort;
// For detailed usage, see: https://serialport.io/docs/guide-usage
Command Line Arguments
HTMLPackerHelper.getArgv() // Returns array: [exePath, ...args]
File Content APIs
// Get content from dd.ini in user directory, throws if not exists
const content = HTMLPackHelper.getFileContent("dd.ini")
// Get content with default value if file doesn't exist
const content = HTMLPackHelper.getFileContent("dd.ini", "default")
// Write content to dd.ini in user directory
HTMLPackHelper.writeFileContent("dd.ini", "content")