mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-29 13:03:09 +03:00
docs(api) fix JSDoc types (#538)
This commit is contained in:
parent
d202007656
commit
f36ce6564c
@ -3,7 +3,7 @@ import tauri from './tauri'
|
||||
/**
|
||||
* @name openDialog
|
||||
* @description Open a file/directory selection dialog
|
||||
* @param {String} [options]
|
||||
* @param {Object} [options]
|
||||
* @param {String} [options.filter]
|
||||
* @param {String} [options.defaultPath]
|
||||
* @param {Boolean} [options.multiple=false]
|
||||
@ -17,7 +17,7 @@ function open (options = {}) {
|
||||
/**
|
||||
* @name save
|
||||
* @description Open a file/directory save dialog
|
||||
* @param {String} [options]
|
||||
* @param {Object} [options]
|
||||
* @param {String} [options.filter]
|
||||
* @param {String} [options.defaultPath]
|
||||
* @returns {Promise<String>} promise resolving to the select path
|
||||
|
@ -2,17 +2,17 @@ import tauri from './tauri'
|
||||
|
||||
/**
|
||||
* The event handler callback
|
||||
* @callback eventCallback
|
||||
* @param {object} event
|
||||
* @param {string} event.type
|
||||
* @callback EventCallback
|
||||
* @param {Object} event
|
||||
* @param {String} event.type
|
||||
* @param {any} [event.payload]
|
||||
*/
|
||||
|
||||
/**
|
||||
* listen to an event from the backend
|
||||
*
|
||||
* @param {string} event the event name
|
||||
* @param {eventCallback} handler the event handler callback
|
||||
* @param {String} event the event name
|
||||
* @param {EventCallback} handler the event handler callback
|
||||
*/
|
||||
function listen (event, handler) {
|
||||
tauri.listen(event, handler)
|
||||
@ -21,8 +21,8 @@ function listen (event, handler) {
|
||||
/**
|
||||
* emits an event to the backend
|
||||
*
|
||||
* @param {string} event the event name
|
||||
* @param {string} [payload] the event payload
|
||||
* @param {String} event the event name
|
||||
* @param {String} [payload] the event payload
|
||||
*/
|
||||
function emit (event, payload) {
|
||||
tauri.emit(event, payload)
|
||||
|
@ -4,8 +4,8 @@ import { Dir } from './dir'
|
||||
/**
|
||||
* reads a file as text
|
||||
*
|
||||
* @param {string} filePath path to the file
|
||||
* @param {object} [options] configuration object
|
||||
* @param {String} filePath path to the file
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
@ -16,8 +16,8 @@ function readTextFile (filePath, options = {}) {
|
||||
/**
|
||||
* reads a file as binary
|
||||
*
|
||||
* @param {string} filePath path to the file
|
||||
* @param {object} [options] configuration object
|
||||
* @param {String} filePath path to the file
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<int[]>}
|
||||
*/
|
||||
@ -28,10 +28,10 @@ function readBinaryFile (filePath, options = {}) {
|
||||
/**
|
||||
* writes a text file
|
||||
*
|
||||
* @param {object} file
|
||||
* @param {string} file.path path of the file
|
||||
* @param {string} file.contents contents of the file
|
||||
* @param {object} [options] configuration object
|
||||
* @param {Object} file
|
||||
* @param {String} file.path path of the file
|
||||
* @param {String} file.contents contents of the file
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@ -40,18 +40,18 @@ function writeFile (file, options = {}) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} FileEntry
|
||||
* @property {string} path
|
||||
* @property {boolean} is_dir
|
||||
* @property {string} name
|
||||
* @typedef {Object} FileEntry
|
||||
* @property {String} path
|
||||
* @property {Boolean} is_dir
|
||||
* @property {String} name
|
||||
*/
|
||||
|
||||
/**
|
||||
* list directory files
|
||||
*
|
||||
* @param {string} dir path to the directory to read
|
||||
* @param {object} [options] configuration object
|
||||
* @param {boolean} [options.recursive] whether to list dirs recursively or not
|
||||
* @param {String} dir path to the directory to read
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {Boolean} [options.recursive] whether to list dirs recursively or not
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<FileEntry[]>}
|
||||
*/
|
||||
@ -64,9 +64,9 @@ function readDir (dir, options = {}) {
|
||||
* If one of the path's parent components doesn't exist
|
||||
* and the `recursive` option isn't set to true, it will be rejected
|
||||
*
|
||||
* @param {string} dir path to the directory to create
|
||||
* @param {object} [options] configuration object
|
||||
* @param {boolean} [options.recursive] whether to create the directory's parent components or not
|
||||
* @param {String} dir path to the directory to create
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {Boolean} [options.recursive] whether to create the directory's parent components or not
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@ -78,9 +78,9 @@ function createDir (dir, options = {}) {
|
||||
* Removes a directory
|
||||
* If the directory is not empty and the `recursive` option isn't set to true, it will be rejected
|
||||
*
|
||||
* @param {string} dir path to the directory to remove
|
||||
* @param {object} [options] configuration object
|
||||
* @param {boolean} [options.recursive] whether to remove all of the directory's content or not
|
||||
* @param {String} dir path to the directory to remove
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {Boolean} [options.recursive] whether to remove all of the directory's content or not
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@ -104,8 +104,8 @@ function copyFile (source, destination, options = {}) {
|
||||
/**
|
||||
* Removes a file
|
||||
*
|
||||
* @param {string} file path to the file to remove
|
||||
* @param {object} [options] configuration object
|
||||
* @param {String} file path to the file to remove
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@ -116,9 +116,9 @@ function removeFile (file, options = {}) {
|
||||
/**
|
||||
* Renames a file
|
||||
*
|
||||
* @param {string} oldPath
|
||||
* @param {string} newPath
|
||||
* @param {object} [options] configuration object
|
||||
* @param {String} oldPath
|
||||
* @param {String} newPath
|
||||
* @param {Object} [options] configuration object
|
||||
* @param {BaseDirectory} [options.dir] base directory
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
|
@ -3,9 +3,9 @@ import tauri from './tauri'
|
||||
/**
|
||||
* spawns a process
|
||||
*
|
||||
* @param {string} command the name of the cmd to execute e.g. 'mkdir' or 'node'
|
||||
* @param {(string[]|string)} [args] command args
|
||||
* @return {Promise<string>} promise resolving to the stdout text
|
||||
* @param {String} command the name of the cmd to execute e.g. 'mkdir' or 'node'
|
||||
* @param {(String[]|String)} [args] command args
|
||||
* @return {Promise<String>} promise resolving to the stdout text
|
||||
*/
|
||||
function execute (command, args) {
|
||||
return tauri.execute(command, args)
|
||||
|
@ -3,7 +3,7 @@ import tauri from './tauri'
|
||||
/**
|
||||
* sets the window title
|
||||
*
|
||||
* @param {string} title the new title
|
||||
* @param {String} title the new title
|
||||
*/
|
||||
function setTitle (title) {
|
||||
tauri.setTitle(title)
|
||||
@ -12,7 +12,7 @@ function setTitle (title) {
|
||||
/**
|
||||
* opens an URL on the user default browser
|
||||
*
|
||||
* @param {string} url the URL to open
|
||||
* @param {String} url the URL to open
|
||||
*/
|
||||
function open (url) {
|
||||
tauri.open(url)
|
||||
|
Loading…
Reference in New Issue
Block a user