mirror of
https://github.com/taigrr/wails.git
synced 2026-04-17 12:15:02 -07:00
Support Dialog in runtime
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user