tauri/cli/tauri.js/api/dialog.js
Lucas Fernandes Nogueira 37e8e79a04
feat(tauri) add dialog API (#514)
* feat(tauri) add dialog API

* feat(example) add dialog API to the communication example

* fix(dialog) transform backslash so it works on windows
2020-03-15 18:09:44 -03:00

33 lines
797 B
JavaScript

import tauri from './tauri'
/**
* @name openDialog
* @description Open a file/directory selection dialog
* @param {String} [options]
* @param {String} [options.filter]
* @param {String} [options.defaultPath]
* @param {Boolean} [options.multiple=false]
* @param {Boolean} [options.directory=false]
* @returns {Promise<String|String[]>} promise resolving to the select path(s)
*/
function open (options = {}) {
return tauri.openDialog(options)
}
/**
* @name save
* @description Open a file/directory save dialog
* @param {String} [options]
* @param {String} [options.filter]
* @param {String} [options.defaultPath]
* @returns {Promise<String>} promise resolving to the select path
*/
function save (options = {}) {
return tauri.saveDialog(options)
}
export {
open,
save
}