Skip to content

TagSpaces is an offline, open source, document manager with tagging support

ML28 - Add jsdoc for the IO api

mladensapb3466023916f
diff --git a/data/chromium/chrome.api.js b/data/chromium/chrome.api.js
index a99d49f87..26b4d4a5e 100644
--- a/data/chromium/chrome.api.js
+++ b/data/chromium/chrome.api.js
@@ -67,6 +67,12 @@ define(function(require, exports, module) {
});*/
}
+ /**
+ * Checks if new version is available
+ * @name checkNewVersion
+ * @method
+ * @memberof IOAPI.Chrome
+ */
function checkNewVersion() {
console.log("Checking for new version...");
var cVer = TSCORE.Config.DefaultSettings.appVersion + "." + TSCORE.Config.DefaultSettings.appBuild;
@@ -82,7 +88,13 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Creates recursively a tree structure for a given directory path
+ * @name createDirectoryTree
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} dirPath - the full path of the directory for which the tree will be generated
+ */
function createDirectoryTree(dirPath) {
TSCORE.showAlertDialog("Creating directory tree not supported.");
//var directoyTree = generateDirectoryTree(dirPath);
@@ -90,7 +102,14 @@ define(function(require, exports, module) {
//TSPOSTIO.createDirectoryTree(directoyTree);
}
-
+ /**
+ * Creates a list with containing the files and the sub directories of a given directory
+ * @name listDirectoryPromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} dirPath - the full path of the directory for which the tree will be generated
+ * @returns {Promise.<Success, Error>}
+ */
function listDirectoryPromise(dirPath) {
//console.log("Listing directory: " + dirPath);
return new Promise(function(resolve, reject) {
@@ -143,6 +162,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Finds out the properties of a file or directory such last modification date or file size
+ * @name getPropertiesPromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} filePath - full path to the file or the directory, which will be analysed
+ * @returns {Promise.<Success, Error>}
+ */
function getPropertiesPromise(filePath) {
return new Promise(function(resolve, reject) {
// TODO use listDirectory to get size and lmdt
@@ -154,11 +181,28 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Load the content of a text file
+ * @name loadTextFilePromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} filePath - the full path of the file which will be loaded
+ * @returns {Promise.<Success, Error>}
+ */
function loadTextFilePromise(filePath) {
//
return getFileContentPromise(filePath, "text");
}
+ /**
+ * Gets the content of file, useful for binary files
+ * @name getFileContentPromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} fullPath - the full path of the file which will be loaded
+ * @param {string} type - the type of the XHR response, defaul is *arraybuffer*
+ * @returns {Promise.<Success, Error>}
+ */
function getFileContentPromise(fullPath, type) {
console.log("getFileContentPromise: " + fullPath);
return new Promise(function(resolve, reject) {
@@ -183,6 +227,16 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Persists a given content(binary supported) to a specified filepath
+ * @name saveFilePromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} filePath - the full path of the file which should be saved
+ * @param {string} content - content that will be saved
+ * @param {boolean} overwrite - if true existing file path will be overwritten
+ * @returns {Promise.<Success, Error>}
+ */
function saveFilePromise(filePath, content, overwrite) {
console.log("Saving binary file: " + filePath);
return new Promise(function(resolve, reject) {
@@ -197,43 +251,91 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Creates a directory
+ * @name createDirectoryPromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} dirPath - the full path of the folder which will be created
+ * @returns {Promise.<Success, Error>}
+ */
function createDirectoryPromise(dirPath) {
return new Promise(function(res, rej) {
rej("Creating directory is not supported in Chrome, please use the desktop version.");
});
}
+ /**
+ * Rename a directory
+ * @name renameDirectoryPromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @returns {Promise.<Success, Error>}
+ */
function renameDirectoryPromise() {
return new Promise(function(res, rej) {
rej("Renaming directory is not supported in Chrome, please use the desktop version.");
});
}
+ /**
+ * Renames a given file
+ * @name renameFilePromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @returns {Promise.<Success, Error>}
+ */
function renameFilePromise() {
return new Promise(function(res, rej) {
rej("Renaming file is not supported in Chrome, please use the desktop version.");
});
}
+ /**
+ * Copies a given file to a specified location
+ * @name copyFilePromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @returns {Promise.<Success, Error>}
+ */
function copyFilePromise() {
return new Promise(function(res, rej) {
rej("Copy file is not supported in Chrome, please use the desktop version.");
});
}
+ /**
+ * Delete a specified file
+ * @name deleteFilePromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @returns {Promise.<Success, Error>}
+ */
function deleteFilePromise() {
return new Promise(function(res, rej) {
rej("Creating directory is not supported in Chrome, please use the desktop version.");
});
}
+ /**
+ * Delete a specified directory, the directory should be empty, if the trash can functionality is not enabled
+ * @name deleteDirectoryPromise
+ * @method
+ * @memberof IOAPI.Chrome
+ * @returns {Promise.<Success, Error>}
+ */
function deleteDirectoryPromise() {
return new Promise(function(res, rej) {
rej("Deleting directory is not supported in Chrome, please use the desktop version.");
});
}
-
+ /**
+ * Selects a directory with the help of a directory chooser
+ * @name selectDirectory
+ * @method
+ * @memberof IOAPI.Chrome
+ */
function selectDirectory() {
console.log("Select directory!");
var rootPath = "/";
@@ -243,17 +345,36 @@ define(function(require, exports, module) {
TSCORE.showDirectoryBrowserDialog(rootPath);
}
+ /**
+ * Selects a file with the help of a file chooser
+ * @name selectFile
+ * @method
+ * @memberof IOAPI.Chrome
+ */
function selectFile() {
// TODO
TSCORE.showAlertDialog("Select file not implemented!");
}
-
+ /**
+ * Opens a directory in the operating system's default file manager
+ * @name openDirectory
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} dirPath - the full path of the directory which will be opened
+ */
function openDirectory(dirPath) {
// TODO
TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openContainingDirectoryAlert"));
}
+ /**
+ * Opens a file with the operating system's default program for the type of the file
+ * @name openFile
+ * @method
+ * @memberof IOAPI.Chrome
+ * @param {string} filePath - the full path of the file which will be opened
+ */
function openFile(filePath) {
// TODO
TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openFileNativelyAlert"));
diff --git a/data/cordova/cordova.api.js b/data/cordova/cordova.api.js
index 123668ac3..52a55b203 100644
--- a/data/cordova/cordova.api.js
+++ b/data/cordova/cordova.api.js
@@ -198,6 +198,13 @@ define(function(require, exports, module) {
);
}
+ /**
+ * Creates recursively a tree structure for a given directory path
+ * @name generateDirectoryTree
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} entries - //TODO
+ */
function generateDirectoryTree(entries) {
var tree = {};
var i;
@@ -310,6 +317,12 @@ define(function(require, exports, module) {
// Platform API
+ /**
+ * Checks if new version is available
+ * @name checkNewVersion
+ * @method
+ * @memberof IOAPI.Cordova
+ */
function checkNewVersion() {
console.log("Checking for new version...");
var cVer = TSCORE.Config.DefaultSettings.appVersion + "." + TSCORE.Config.DefaultSettings.appBuild;
@@ -325,11 +338,17 @@ define(function(require, exports, module) {
});
}
+ /**
+ *Bring the TagSpaces window on top of the windows
+ *@name focusWindow
+ *mthod
+ *@memberof IOAPI.Cordova
+ */
function focusWindow() {
// Bring the TagSpaces window on top of the windows
console.log("Focusing window is not implemented in cordova.");
}
-
+ //TODO
function handleStartParameters() {
if (urlFromIntent !== undefined && urlFromIntent.length > 0) {
console.log("Intent URL: " + urlFromIntent);
@@ -338,14 +357,29 @@ define(function(require, exports, module) {
}
}
-
+ /**
+ * Creates recursively a tree structure for a given directory path
+ * @name createDirectoryTree
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} dirPath - the full path of the directory for which the tree will be generated
+ */
function createDirectoryTree(dirPath) {
// TODO
TSCORE.hideLoadingAnimation();
TSCORE.showAlertDialog("Creating directory tree is not supported in Cordova yet.");
}
-
+ /**
+ * Creates a list with containing the files and the sub directories of a given directory
+ * @name listDirectoryPromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} path - the directory path for which the list will be created
+ * @param {boolean} lite - if true the path to a file thumbnails will be not included in the results
+ * This will increase the performance of the function.
+ * @returns {Promise.<Success, Error>}
+ */
function listDirectoryPromise(path, lite) {
console.time("listDirectoryPromise");
return new Promise(function(resolve, reject) {
@@ -425,6 +459,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Finds out the properties of a file or directory such last modification date or file size
+ * @name getPropertiesPromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - full path to the file or the directory, which will be analysed
+ * @returns {Promise.<Success, Error>}
+ */
function getPropertiesPromise(filePath) {
return new Promise(function(resolve, reject) {
filePath = normalizePath(filePath);
@@ -464,12 +506,28 @@ define(function(require, exports, module) {
//});
}
-
+ /**
+ * Load the content of a text file
+ * @name loadTextFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which will be loaded
+ * @returns {Promise.<Success, Error>}
+ */
function loadTextFilePromise(filePath) {
//
return getFileContentPromise(filePath, "text");
}
+ /**
+ * Gets the content of file, useful for binary files
+ * @name getFileContentPromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} fullPath - the full path of the file which will be loaded
+ * @param {string} type - the type of the XHR response, defaul is *arraybuffer*
+ * @returns {Promise.<Success, Error>}
+ */
function getFileContentPromise(filePath, type, resolvePath) {
// TODO refactor
var getFilePromise = function(filePath, resolvePath) {
@@ -521,7 +579,16 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Persists a given content(binary supported) to a specified filepath
+ * @name saveFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which should be saved
+ * @param {string} content - content that will be saved
+ * @param {boolean} overWrite - if true existing file path will be overwritten
+ * @returns {Promise.<Success, Error>}
+ */
function saveFilePromise(filePath, content, overWrite) {
console.log("Saving file: " + filePath);
return new Promise(function(resolve, reject) {
@@ -570,6 +637,16 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Persists a given text content to a specified filepath
+ * @name saveTextFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which will be saved
+ * @param {string} content - content that will be saved
+ * @param {string} overWrite - if true existing file path will be overwritten
+ * @returns {Promise.<Success, Error>}
+ */
function saveTextFilePromise(filePath, content, overWrite) {
console.log("Saving file: " + filePath);
// Handling the UTF8 support for text files
@@ -582,13 +659,30 @@ define(function(require, exports, module) {
return saveFilePromise(filePath, content, overWrite);
}
+ /**
+ * Persists a given binary content to a specified filepath
+ * @name saveBinaryFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which will be saved
+ * @param {string} content - content that will be saved
+ * @param {string} overWrite - if true existing file path will be overwritten
+ * @returns {Promise.<Success, Error>}
+ */
function saveBinaryFilePromise(filePath, content, overWrite) {
console.log("Saveing binary file: " + filePath);
var dataView = new Int8Array(content);
return saveFilePromise(filePath, dataView, overWrite);
}
-
+ /**
+ * Creates a directory
+ * @name createDirectoryPromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} dirPath - the full path of the folder which will be created
+ * @returns {Promise.<Success, Error>}
+ */
function createDirectoryPromise(dirPath) {
console.log("Creating directory: " + dirPath);
return new Promise(function(resolve, reject) {
@@ -607,7 +701,15 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Copies a given file to a specified location
+ * @name copyFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of a file which will be copied
+ * @param {string} newFilePath - the full path destination of the copied file
+ * @returns {Promise.<Success, Error>}
+ */
function copyFilePromise(filePath, newFilePath) {
return new Promise(function(resolve, reject) {
filePath = normalizePath(filePath);
@@ -648,6 +750,15 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Renames a given file
+ * @name renameFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which will be renamed
+ * @param {string} newFilePath - the desired full path after the file rename
+ * @returns {Promise.<Success, Error>}
+ */
function renameFilePromise(filePath, newFilePath) {
return new Promise(function(resolve, reject) {
@@ -691,6 +802,15 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Rename a directory
+ * @name renameDirectoryPromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} dirPath - the full path of the directory which will be renamed
+ * @param {string} newDirName - the desired full path after the directory rename
+ * @returns {Promise.<Success, Error>}
+ */
function renameDirectoryPromise(dirPath, newDirName) {
return new Promise(function(resolve, reject) {
@@ -736,7 +856,14 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Delete a specified file
+ * @name deleteFilePromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which will be deleted
+ * @returns {Promise.<Success, Error>}
+ */
function deleteFilePromise(filePath) {
return new Promise(function(resolve, reject) {
var path = normalizePath(filePath);
@@ -762,6 +889,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Delete a specified directory, the directory should be empty, if the trash can functionality is not enabled
+ * @name deleteDirectoryPromise
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} dirPath - the full path of the directory which will be deleted
+ * @returns {Promise.<Success, Error>}
+ */
function deleteDirectoryPromise(dirPath) {
console.log("Deleting directory: " + dirPath);
return new Promise(function(resolve, reject) {
@@ -791,23 +926,48 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Selects a directory with the help of a directory chooser
+ * @name selectDirectory
+ * @method
+ * @memberof IOAPI.Cordova
+ */
function selectDirectory() {
console.log("Open select directory dialog.");
TSCORE.showDirectoryBrowserDialog(fsRoot.fullPath);
}
+ /**
+ * Selects a file with the help of a file chooser
+ * @name selectFile
+ * @method
+ * @memberof IOAPI.Cordova
+ */
function selectFile() {
//
console.log("Operation selectFile not supported.");
}
-
+ /**
+ * Opens a directory in the operating system's default file manager
+ * @name openDirectory
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} dirPath - the full path of the directory which will be opened
+ * @returns {Promise.<Success, Error>}
+ */
function openDirectory(dirPath) {
TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openContainingDirectoryAlert"));
}
+ /**
+ * Opens a file with the operating system's default program for the type of the file
+ * @name openFile
+ * @method
+ * @memberof IOAPI.Cordova
+ * @param {string} filePath - the full path of the file which will be opened
+ */
function openFile(filePath) {
console.log("Opening natively: " + filePath);
window.plugins.fileOpener.open(filePath);
diff --git a/data/mozilla/mozilla.api.js b/data/mozilla/mozilla.api.js
index 4a89daf47..b4321d43a 100644
--- a/data/mozilla/mozilla.api.js
+++ b/data/mozilla/mozilla.api.js
@@ -110,6 +110,12 @@ define(function(require, exports, module) {
document.documentElement.dispatchEvent(event);
}
+ /**
+ * Checks if new version is available
+ * @name checkNewVersion
+ * @method
+ * @memberof IOAPI.Mozilla
+ */
function checkNewVersion() {
console.log("Checking for new version...");
var event = document.createEvent('CustomEvent');
@@ -121,7 +127,14 @@ define(function(require, exports, module) {
document.documentElement.dispatchEvent(event);
}
-
+ /**
+ * Creates a list with containing the files and the sub directories of a given directory
+ * @name listDirectoryPromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} dirPath - the directory path which is listed
+ * @returns {Promise.<Success, Error>}
+ */
function listDirectoryPromise(dirPath) {
return new Promise(function(resolve, reject) {
@@ -150,6 +163,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Finds out the properties of a file or directory such last modification date or file size
+ * @name getPropertiesPromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - full path to the file or the directory, which will be analysed
+ * @returns {Promise.<Success, Error>}
+ */
function getPropertiesPromise(filePath) {
console.log("Getting file properties...");
return new Promise(function(resolve, reject) {
@@ -178,6 +199,13 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Creates recursively a tree structure for a given directory path
+ * @name createDirectoryTree
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} dirPath - the full path of the directory for which the tree will be generated
+ */
function createDirectoryTree(dirPath) {
console.log("Creating directory tree for: " + dirPath);
var event = document.createEvent('CustomEvent');
@@ -190,12 +218,28 @@ define(function(require, exports, module) {
document.documentElement.dispatchEvent(event);
}
-
+ /**
+ * Load the content of a text file
+ * @name loadTextFilePromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - the full path of the file which will be loaded
+ * @returns {Promise.<Success, Error>}
+ */
function loadTextFilePromise(filePath) {
//
return getFileContentPromise(filePath, "text");
}
+ /**
+ * Gets the content of file, useful for binary files
+ * @name getFileContentPromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} fullPath - the full path of the file which will be loaded
+ * @param {string} type - the type of the XHR response, defaul is *arraybuffer*
+ * @returns {Promise.<Success, Error>}
+ */
function getFileContentPromise(filePath, type) {
console.log("getFileContentPromise: " + filePath);
return new Promise(function(resolve, reject) {
@@ -232,7 +276,16 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Persists a given content(binary supported) to a specified filepath
+ * @name saveFilePromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - the full path of the file which should be saved
+ * @param {string} content - content that will be saved
+ * @param {boolean} overWrite - if true existing file path will be overwritten
+ * @returns {Promise.<Success, Error>}
+ */
function saveFilePromise(filePath, content, overWrite) {
return new Promise(function(resolve, reject) {
console.log("Saving file: " + filePath);
@@ -261,6 +314,16 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Persists a given binary content to a specified filepath
+ * @name saveBinaryFilePromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - the full path of the file which will be saved
+ * @param {string} content - content that will be saved
+ * @param {string} overWrite - if true existing file path will be overwritten
+ * @returns {Promise.<Success, Error>}
+ */
function saveBinaryFilePromise(filePath, content, overWrite) {
return new Promise(function(resolve, reject) {
console.log("Saving binary file post: " + filePath); //+" - "+content);
@@ -289,7 +352,14 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Creates a directory
+ * @name createDirectory
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} dirPath - the full path of the folder which will be created
+ * @param {string} silentMode - //TODO
+ */
function createDirectory(dirPath, silentMode) {
createDirectoryPromise(dirPath).then(function() {
if(!silentMode) {
@@ -300,6 +370,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Creates a directory
+ * @name createDirectoryPromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} dirPath - the full path of the folder which will be created
+ * @returns {Promise.<Success, Error>}
+ */
function createDirectoryPromise(dirPath) {
return new Promise(function(resolve, reject) {
console.log("Directory " + dirPath + " created.");
@@ -326,7 +404,15 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Copies a given file to a specified location
+ * @name copyFilePromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - the full path of a file which will be copied
+ * @param {string} newFilePath - the full path destination of the copied file
+ * @returns {Promise.<Success, Error>}
+ */
function copyFilePromise(filePath, newFilePath) {
return new Promise(function(resolve, reject) {
console.log("Copy " + filePath + " to " + newFilePath);
@@ -353,7 +439,15 @@ define(function(require, exports, module) {
document.documentElement.addEventListener("tsMessage", eventListener);
});
}
-
+ /**
+ * Renames a given file
+ * @name renameFilePromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - the full path of the file which will be renamed
+ * @param {string} newPath - the desired full path after the file rename
+ * @returns {Promise.<Success, Error>}
+ */
function renameFilePromise(filePath, newPath) {
return new Promise(function(resolve, reject) {
console.log("Renaming " + filePath + " to " + newFilePath);
@@ -382,6 +476,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Rename a directory
+ * @name renameDirectoryPromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} path - the full path of the directory which will be renamed
+ * @returns {Promise.<Success, Error>}
+ */
function renameDirectoryPromise(path) {
return new Promise(function(res, rej) {
TSCORE.showAlertDialog($.i18n.t("ns.common:functionalityNotImplemented"));
@@ -389,7 +491,14 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Delete a specified file
+ * @name deleteFilePromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} path - the full path of the file which will be deleted
+ * @returns {Promise.<Success, Error>}
+ */
function deleteFilePromise(path) {
return new Promise(function(resolve, reject) {
console.log("Deleting: " + path);
@@ -417,6 +526,14 @@ define(function(require, exports, module) {
});
}
+ /**
+ * Delete a specified directory, the directory should be empty, if the trash can functionality is not enabled
+ * @name deleteDirectoryPromise
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} path - the full path of the directory which will be deleted
+ * @returns {Promise.<Success, Error>}
+ */
function deleteDirectoryPromise(path) {
return new Promise(function(res, rej) {
TSCORE.showAlertDialog($.i18n.t("ns.common:functionalityNotImplemented"));
@@ -424,7 +541,12 @@ define(function(require, exports, module) {
});
}
-
+ /**
+ * Selects a directory with the help of a directory chooser
+ * @name selectDirectory
+ * @method
+ * @memberof IOAPI.Mozilla
+ */
function selectDirectory() {
console.log("Selecting directory...");
var event = document.createEvent('CustomEvent');
@@ -435,7 +557,12 @@ define(function(require, exports, module) {
});
document.documentElement.dispatchEvent(event);
}
-
+ /**
+ * Selects a file with the help of a file chooser
+ * @name selectFile
+ * @method
+ * @memberof IOAPI.Mozilla
+ */
function selectFile() {
console.log("Selecting file...");
var event = document.createEvent('CustomEvent');
@@ -447,7 +574,13 @@ define(function(require, exports, module) {
document.documentElement.dispatchEvent(event);
}
-
+ /**
+ * Opens a directory in the operating system's default file manager
+ * @name openDirectory
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} dirPath - the full path of the directory which will be opened
+ */
function openDirectory(dirPath) {
console.log("Opening directory: " + dirPath);
var event = document.createEvent('CustomEvent');
@@ -460,6 +593,13 @@ define(function(require, exports, module) {
document.documentElement.dispatchEvent(event);
}
+ /**
+ * Opens a file with the operating system's default program for the type of the file
+ * @name openFile
+ * @method
+ * @memberof IOAPI.Mozilla
+ * @param {string} filePath - the full path of the file which will be opened
+ */
function openFile(filePath) {
// TODO implement openFile for firefox
console.log("Open file functionality not implemented in Firefox yet!");
diff --git a/data/node-webkit/node-webkit.api.js b/data/node-webkit/node-webkit.api.js
index 9585e3894..3e1d50baf 100644
--- a/data/node-webkit/node-webkit.api.js
+++ b/data/node-webkit/node-webkit.api.js
@@ -205,12 +205,7 @@ define(function(require, exports, module) {
// IOAPI
- /**
- * Checks if new version is available
- * @name checkNewVersion
- * @method
- * @memberof IOAPI.NWJS
- */
+``
function checkNewVersion() {
console.log("Checking for new version...");
var cVer = TSCORE.Config.DefaultSettings.appVersion + "." + TSCORE.Config.DefaultSettings.appBuild;
@@ -787,9 +782,8 @@ define(function(require, exports, module) {
* Opens a directory in the operating system's default file manager
* @name openDirectory
* @method
- * @memberof nwjs.ioapi
+ * @memberof IOAPI.NWJS
* @param {string} dirPath - the full path of the directory which will be opened
- * @returns {Promise.<Success, Error>}
*/
function openDirectory(dirPath) {
// opens directory