Support Dialog in runtime

This commit is contained in:
Lea Anthony
2020-11-19 07:04:08 +11:00
parent 069de31003
commit eaeecbb180
7 changed files with 145 additions and 14 deletions

View File

@@ -10,14 +10,57 @@ The lightweight framework for web-like apps
/* jshint esversion: 6 */
import { SendMessage } from 'ipc';
import { SystemCall } from './calls';
/**
* Open a dialog with the given parameters
* @type {Object} OpenDialog
* @param {string} [DefaultDirectory=""]
* @param {string} [DefaultFilename=""]
* @param {string} [Title=""]
* @param {string} [Filters=""]
* @param {bool} [AllowFiles=false]
* @param {bool} [AllowDirectories=false]
* @param {bool} [AllowMultiple=false]
* @param {bool} [ShowHiddenFiles=false]
* @param {bool} [CanCreateDirectories=false]
* @param {bool} [ResolvesAliases=false] - Mac Only: Resolves aliases (symlinks)
* @param {bool} [TreatPackagesAsDirectories=false] - Mac Only: Show packages (EG Applications) as folders
*/
/**
* Opens a dialog using the given paramaters, prompting the user to
* select files/folders.
*
* @export
* @param {object} options
* @param {OpenDialogOptions} options
* @returns {Promise<Array<string>>} - List of files/folders selected
*/
export function Open(options) {
SendMessage('DO'+JSON.stringify(options));
return SystemCall('Dialog.Open', options);
}
/**
*
* @type {Object} SaveDialogOptions
* @param {string} [DefaultDirectory=""]
* @param {string} [DefaultFilename=""]
* @param {string} [Title=""]
* @param {string} [Filters=""]
* @param {bool} [ShowHiddenFiles=false]
* @param {bool} [CanCreateDirectories=false]
* @param {bool} [TreatPackagesAsDirectories=false]
*/
/**
* Opens a dialog using the given paramaters, prompting the user to
* select a single file/folder.
*
* @export
* @param {SaveDialogOptions} options
* @returns {Promise<string>}
*/
export function Save(options) {
return SystemCall('Dialog.Save', options);
}