зеркало из https://github.com/microsoft/TACO.git
Based on initial feedback, ripped out unnecessary d.ts files, all ts files will be compiled and generate JS binplaced in bin folder.
Structure of bin folder: ├───taco-cli │ ├───lib │ ├───taco-cli │ └───utility └───utility
This commit is contained in:
Родитель
1da12fdf6b
Коммит
68fe1d818e
|
@ -1,18 +1,55 @@
|
||||||
/// <reference path="../typings/node/node.d.ts" />
|
/// <reference path="../typings/node/node.d.ts" />
|
||||||
/// <reference path="./lib/compile/gulpfile.ts" />
|
/// <reference path="../utility/typescriptUtil.ts" />
|
||||||
|
/// <reference path="../utility/styleCopUtil.ts" />
|
||||||
|
|
||||||
|
var fs = require("fs");
|
||||||
var gulp = require("gulp");
|
var gulp = require("gulp");
|
||||||
require("./lib/compile/gulpfile");
|
var path = require("path");
|
||||||
|
var typescriptUtil = require("../utility/typescriptUtil");
|
||||||
|
var styleCopUtil = require("../utility/styleCopUtil");
|
||||||
|
var eventStream = require("event-stream");
|
||||||
|
var concat = require("gulp-concat");
|
||||||
|
var del = require("del");
|
||||||
|
|
||||||
import styleCopUtil = require ("../utility/styleCopUtil");
|
var compilerPath = {
|
||||||
|
src: "../../..", // gulp task compiles all source under "taco-cli" source folder
|
||||||
|
bin: "../..",
|
||||||
|
};
|
||||||
|
|
||||||
/* Project wide tasks. */
|
////////////////// to add additional gulp tasks, add gulpfile in folder and reference it below
|
||||||
gulp.task("default", ["compilerDefault", "styleCop"]);
|
// for example: require('./src/compile/gulpfile');
|
||||||
|
///////////////////////
|
||||||
|
|
||||||
/* Runs style cop on the utilities. */
|
/* Project wide tasks below, 1 entry for each gulp task */
|
||||||
gulp.task("styleCop", ["compilerStyleCop"], function (cb: Function): void {
|
gulp.task("default", ["compilerDefault", "compilerStyleCop"]);
|
||||||
var styleCop = new styleCopUtil.CordovaTools.StyleCopUtil();
|
|
||||||
styleCop.runCop("../utility", "../../internal/TSStyleCop/TSStyleCop.js", cb);
|
/* Default task for compiler - runs clean, compile, combine. */
|
||||||
|
gulp.task("compilerDefault", ["compilerClean", "compilerCompile", "compilerStyleCop"]);
|
||||||
|
|
||||||
|
/* Compiles the typescript files in the project. */
|
||||||
|
gulp.task("compilerCompile", ["compilerClean"], function (cb: Function): void {
|
||||||
|
var tsUtil = new typescriptUtil.CordovaTools.TypescriptServices();
|
||||||
|
console.log("compilerPath.src: " + path.resolve(compilerPath.src));
|
||||||
|
console.log("compilerPath.bin: " + path.resolve(compilerPath.bin));
|
||||||
|
tsUtil.compileDirectory(compilerPath.src, compilerPath.bin, cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Cleans up the bin location. */
|
||||||
|
gulp.task("compilerClean", function (cb: Function): void {
|
||||||
|
del([compilerPath.bin + "**"], cb);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Runs style cop on the sources. */
|
||||||
|
gulp.task("compilerStyleCop", function (cb: Function): void {
|
||||||
|
var copFile = "../../../../../Internal/TSStyleCop/TSStyleCop.js";
|
||||||
|
if (!fs.existsSync("copFile")) {
|
||||||
|
var styleCop = new styleCopUtil.CordovaTools.StyleCopUtil();
|
||||||
|
styleCop.runCop(compilerPath.src, copFile, cb);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Task to generate NPM package */
|
||||||
|
|
||||||
|
/* Test */
|
||||||
|
|
||||||
module.exports = gulp;
|
module.exports = gulp;
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/// <reference path="../../../typings/node/node.d.ts" />
|
|
||||||
/// <reference path="../../../typings/gulp/gulp.d.ts" />
|
|
||||||
|
|
||||||
import gulp = require ("gulp");
|
|
||||||
import fs = require ("fs");
|
|
||||||
import path = require ("path");
|
|
||||||
import ts = require ("typescript");
|
|
||||||
import child_process = require ("child_process");
|
|
||||||
|
|
||||||
import typescriptUtil = require ("../../../utility/typescriptUtil");
|
|
||||||
import styleCopUtil = require ("../../../utility/styleCopUtil");
|
|
||||||
|
|
||||||
var eventStream = require("event-stream");
|
|
||||||
var concat = require("gulp-concat");
|
|
||||||
var del = require("del");
|
|
||||||
|
|
||||||
/* Source path declarations for all the projects. Add a new path variable for each project & customize it as needed. */
|
|
||||||
var compilerPath = {
|
|
||||||
src: ".",
|
|
||||||
bin: "./bin",
|
|
||||||
binSrc: "./bin/taco-cli/templates/typescript_hook",
|
|
||||||
binUtil: "./bin/utility",
|
|
||||||
templatesSrc: "./templates/typescript_hook"
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Default task for compiler - runs clean, compile, combine. */
|
|
||||||
gulp.task("compilerDefault", ["compilerClean", "compilerCompile", "compilerMerge", "compilerStyleCop"]);
|
|
||||||
|
|
||||||
/* Compiles the typescript files in the project. */
|
|
||||||
gulp.task("compilerCompile", ["compilerClean"], function (cb: Function): void {
|
|
||||||
var tsUtil = new typescriptUtil.CordovaTools.TypescriptServices();
|
|
||||||
console.log("compilerPath.src: " + path.resolve(compilerPath.src));
|
|
||||||
console.log("compilerPath.bin: " + path.resolve(compilerPath.bin));
|
|
||||||
|
|
||||||
tsUtil.compileDirectory(compilerPath.src, compilerPath.bin, cb);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Merges certain files after compilation. You can add to this task any post-compilation processing needed for your scenario. */
|
|
||||||
gulp.task("compilerMerge", ["compilerCompile"], function (): void {
|
|
||||||
gulp.src([compilerPath.templatesSrc + "/nodeEnv.js", compilerPath.binUtil + "/typescriptUtil.js", compilerPath.binSrc + "/compileTypescript.js"])
|
|
||||||
.pipe(concat("compileTypescriptNode.js"))
|
|
||||||
.pipe(gulp.dest(compilerPath.binSrc));
|
|
||||||
gulp.src([compilerPath.templatesSrc + "/nodeEnv.js", compilerPath.binSrc + "/main.js"])
|
|
||||||
.pipe(concat("taco-compile"))
|
|
||||||
.pipe(gulp.dest(compilerPath.binSrc));
|
|
||||||
gulp.src(compilerPath.templatesSrc + "compileTypescriptConfig.json")
|
|
||||||
.pipe(gulp.dest(compilerPath.binSrc));
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Cleans up the bin location. */
|
|
||||||
gulp.task("compilerClean", function (cb: Function): void {
|
|
||||||
del([compilerPath.bin + "**"], cb);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Runs style cop on the sources. */
|
|
||||||
gulp.task("compilerStyleCop", /*["compilerMerge"],*/ function (cb: Function): void {
|
|
||||||
var styleCop = new styleCopUtil.CordovaTools.StyleCopUtil();
|
|
||||||
styleCop.runCop(compilerPath.src, "../../Internal/TSStyleCop/TSStyleCop.js", cb);
|
|
||||||
});
|
|
||||||
|
|
||||||
export = gulp;
|
|
|
@ -1,42 +1,79 @@
|
||||||
//boostrap project
|
//boostrap project
|
||||||
|
|
||||||
var exec = require("child_process").exec,
|
var exec = require("child_process").exec,
|
||||||
|
fs = require("fs");
|
||||||
path = require('path');
|
path = require('path');
|
||||||
|
|
||||||
console.log("************************************************************");
|
console.log("************************************************************");
|
||||||
console.log("Preparing taco-cli project for first use.....");
|
console.log("Preparing taco-cli project for first use.....");
|
||||||
console.log("Run 'gulp' in current directory to build the project.");
|
console.log("Run 'gulp' in ./bin/taco-cli/taco-cli to build the project.");
|
||||||
console.log("************************************************************\n\n");
|
console.log("************************************************************\n\n");
|
||||||
|
|
||||||
var installGlobalPackage = function (packageName) {
|
//delete folder recursively
|
||||||
packageCommand = "npm ls -g " + packageName;
|
var deleteFolderRecursive = function (path) {
|
||||||
var result = exec(packageCommand, function (error, stdout, stderr) {
|
if (fs.existsSync(path)) {
|
||||||
if (stdout.indexOf(packageName) > -1) {
|
fs.readdirSync(path).forEach(function (file, index) {
|
||||||
console.log("---found '" + packageName + "' installed globally");
|
var curPath = path + "/" + file;
|
||||||
} else {
|
if (fs.lstatSync(curPath).isDirectory()) { // recurse
|
||||||
console.log("---did not find " + packageName + " installed globally, installing.....")
|
deleteFolderRecursive(curPath);
|
||||||
exec("npm install -g " + packageName);
|
} else { // delete file
|
||||||
}
|
fs.unlinkSync(curPath);
|
||||||
|
}
|
||||||
if (packageName == "typescript") {
|
});
|
||||||
//compile root gulptfile.ts
|
fs.rmdirSync(path);
|
||||||
console.log("---compiling gulpfile.ts");
|
}
|
||||||
var compileTSOutput = exec("tsc gulpfile.ts --module commonjs", { cwd: "." });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//install global packages
|
|
||||||
installGlobalPackage("typescript");
|
|
||||||
installGlobalPackage("gulp");
|
|
||||||
|
|
||||||
////npm install on relevant folders
|
var run = function () {
|
||||||
var foldersToPrep = [".",
|
if (fs.existsSync("bin")) {
|
||||||
"../utility"
|
console.log("---removing bin folder")
|
||||||
];
|
deleteFolderRecursive("bin")
|
||||||
|
}
|
||||||
|
|
||||||
foldersToPrep.forEach(function (folder) {
|
//compile root gulptfile.ts
|
||||||
console.log("---NPM install on folder: " + path.resolve(folder));
|
var compileMainGulp = function () {
|
||||||
var npmProcess = exec("npm install", { cwd: folder });
|
var gulpJS = "./bin/taco-cli/taco-cli/gulpfile.js";
|
||||||
});
|
exec("tsc gulpfile.ts --outdir bin/taco-cli --module commonjs", { cwd: "." }, function (error, stdout, stderr) {
|
||||||
|
if (fs.existsSync(gulpJS)) {
|
||||||
|
console.log("---compiled " + gulpJS);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var installGlobalPackage = function (packageName) {
|
||||||
|
packageCommand = "npm ls -g " + packageName;
|
||||||
|
var result = exec(packageCommand, function (error, stdout, stderr) {
|
||||||
|
if (stdout.indexOf(packageName) > -1) {
|
||||||
|
console.log("---found '" + packageName + "' installed globally");
|
||||||
|
} else {
|
||||||
|
console.log("---did not find " + packageName + " installed globally, installing.....")
|
||||||
|
exec("npm install -g " + packageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packageName == "typescript") {
|
||||||
|
compileMainGulp();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//install global packages
|
||||||
|
installGlobalPackage("typescript");
|
||||||
|
|
||||||
|
|
||||||
|
////npm install on relevant folders
|
||||||
|
var foldersToPrep = ["."];
|
||||||
|
|
||||||
|
foldersToPrep.forEach(function (folder) {
|
||||||
|
console.log("---NPM install on folder: " + path.resolve(folder));
|
||||||
|
var npmProcess = exec("npm install", { cwd: folder }, function (error, stdout, stderr) { compileMainGulp() });
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
installGlobalPackage("gulp");
|
||||||
|
};
|
||||||
|
|
||||||
|
run();
|
|
@ -1,105 +0,0 @@
|
||||||
/// <reference path='../../../typings/node/node.d.ts' />
|
|
||||||
/// <reference path='../../../utility/typescriptUtil.ts' />
|
|
||||||
|
|
||||||
import child_process = require ("child_process");
|
|
||||||
import path = require ("path");
|
|
||||||
import fs = require ("fs");
|
|
||||||
import ts = require ("typescript");
|
|
||||||
|
|
||||||
export module CordovaTools {
|
|
||||||
/**
|
|
||||||
* Compiler configuration interface.
|
|
||||||
*/
|
|
||||||
interface ICompilerConfiguration {
|
|
||||||
filesRoot: string;
|
|
||||||
options: ts.CompilerOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In charge of invoking the typescript compiler.
|
|
||||||
*/
|
|
||||||
export class TSCInvoker {
|
|
||||||
private static DEFAULT_SOURCE_DIRECTORIES = "www;merges";
|
|
||||||
private static CONFIGURATION_FILE_PATH = path.join("hooks", "before_prepare", "compile-typescript", "tsc-config.json");
|
|
||||||
private static DEFAULT_COMPILER_OPTIONS: ICompilerConfiguration = {
|
|
||||||
filesRoot: "www;merges",
|
|
||||||
options: {
|
|
||||||
target: ts.ScriptTarget.ES5,
|
|
||||||
module: ts.ModuleKind.CommonJS
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private _compileCallback = (error: any) => {
|
|
||||||
console.log("Compilation " + (error ? "failed" : "succeeded") + ".");
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compiles the typescript files in the project.
|
|
||||||
*/
|
|
||||||
public compileProject(): void {
|
|
||||||
// TypescriptServices will be merged in the destination file
|
|
||||||
var typeScriptServices: any = (<any>CordovaTools).TypescriptServices;
|
|
||||||
var typescriptUtil = new typeScriptServices();
|
|
||||||
|
|
||||||
console.log("\nReading configuration...");
|
|
||||||
var configuration: ICompilerConfiguration = this.readConfiguration();
|
|
||||||
|
|
||||||
var sourceFiles: string[] = [];
|
|
||||||
var projectDirectory = process.argv[2];
|
|
||||||
|
|
||||||
/* Add the source files. */
|
|
||||||
var sourceLocations = (configuration && configuration.filesRoot) ? configuration.filesRoot : TSCInvoker.DEFAULT_SOURCE_DIRECTORIES;
|
|
||||||
console.log("\nSearching for typescript source files...");
|
|
||||||
console.log("Searching the following location(s): " + sourceLocations);
|
|
||||||
|
|
||||||
var filesRootDirectories = sourceLocations.split(";");
|
|
||||||
for (var i = 0; i < filesRootDirectories.length; i++) {
|
|
||||||
typescriptUtil.getProjectTypescriptFiles(path.join(projectDirectory, filesRootDirectories[i]), sourceFiles);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Found typescript sources:");
|
|
||||||
for (var i = 0; i < sourceFiles.length; i++) {
|
|
||||||
console.log(sourceFiles[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("\nCompiling...");
|
|
||||||
typescriptUtil.compileTypescript(configuration.options, sourceFiles, this._compileCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the compiler configuration from the tsc-cofig.json file.
|
|
||||||
*/
|
|
||||||
private readConfiguration(): ICompilerConfiguration {
|
|
||||||
var result: ICompilerConfiguration;
|
|
||||||
var configurationPath = path.join(process.argv[2], TSCInvoker.CONFIGURATION_FILE_PATH);
|
|
||||||
|
|
||||||
/* try to read the adjacent configuration file */
|
|
||||||
try {
|
|
||||||
if (fs.existsSync(configurationPath)) {
|
|
||||||
var buffer = fs.readFileSync(TSCInvoker.CONFIGURATION_FILE_PATH);
|
|
||||||
if (buffer) {
|
|
||||||
result = JSON.parse(buffer.toString());
|
|
||||||
console.log("Configuration read from: " + configurationPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Configuration could not be read.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
console.warn("Using default settings for typescript compilation.");
|
|
||||||
result = TSCInvoker.DEFAULT_COMPILER_OPTIONS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
var compiler = new CordovaTools.TSCInvoker();
|
|
||||||
compiler.compileProject();
|
|
||||||
} catch (e) {
|
|
||||||
console.log("\nAn error occurred while compiling the typescript files: " + e);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"filesRoot": "www;merges",
|
|
||||||
"options": {
|
|
||||||
"target": 1,
|
|
||||||
"module": 1
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
/// <reference path="../../../typings/node/node.d.ts" />
|
|
||||||
|
|
||||||
import fs = require ("fs");
|
|
||||||
import path = require ("path");
|
|
||||||
|
|
||||||
export module CordovaTools {
|
|
||||||
export class HookInstaller {
|
|
||||||
private static HOOK_NAME: string = "compileTypescriptNode.js";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Installs the typescript compilation hook in a Cordova project from a specified source folder.
|
|
||||||
*/
|
|
||||||
public installTypescriptHookFromFolder(hookSourceFolder: string, projectRootPath: string): void {
|
|
||||||
console.log("Hook source folder: " + hookSourceFolder);
|
|
||||||
console.log("Project root path: " + projectRootPath);
|
|
||||||
|
|
||||||
if (!fs.existsSync(projectRootPath)) {
|
|
||||||
console.log("The project root path does not exist: " + projectRootPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(projectRootPath, "www")) || !fs.existsSync(path.join(projectRootPath, "config.xml"))) {
|
|
||||||
console.log("The provided directory is not a Cordova-based project.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hookDestinationFolder = path.join(projectRootPath, "hooks", "before_prepare");
|
|
||||||
console.log("Hook destination folder: " + hookDestinationFolder);
|
|
||||||
|
|
||||||
this.ensureFolder(path.join(projectRootPath, "hooks"));
|
|
||||||
this.ensureFolder(hookDestinationFolder);
|
|
||||||
var hookPath = path.join(hookSourceFolder, HookInstaller.HOOK_NAME);
|
|
||||||
console.log("Hook path: " + hookPath);
|
|
||||||
|
|
||||||
this.copyFileAsync(hookPath, path.join(hookDestinationFolder, HookInstaller.HOOK_NAME));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Installs the hook from the current executing script folder.
|
|
||||||
*/
|
|
||||||
public installTypescriptHook(projectRootPath: string): void {
|
|
||||||
var hookSourceFolder = path.dirname(process.argv[1]);
|
|
||||||
this.installTypescriptHookFromFolder(hookSourceFolder, projectRootPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies a file from the source location path to the destination path.
|
|
||||||
*/
|
|
||||||
private copyFileAsync(sourcePath: string, destinationPath: string): void {
|
|
||||||
if (!fs.existsSync(sourcePath)) {
|
|
||||||
console.log("The file does not exist: " + sourcePath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var readStream = fs.createReadStream(sourcePath);
|
|
||||||
readStream.pipe(fs.createWriteStream(destinationPath));
|
|
||||||
readStream.on("end", function (): void { console.log("\nHook installed."); });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a folder if it does not exist.
|
|
||||||
*/
|
|
||||||
private ensureFolder(path: string): void {
|
|
||||||
var folderExists = fs.existsSync(path);
|
|
||||||
console.log("Folder " + path + " exists: " + folderExists);
|
|
||||||
if (!folderExists) {
|
|
||||||
console.log("Creating folder: " + path);
|
|
||||||
fs.mkdirSync(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
/// <reference path='../../../typings/node/node.d.ts' />
|
|
||||||
|
|
||||||
import installerModule = require ("./hookInstaller");
|
|
||||||
var installer = new installerModule.CordovaTools.HookInstaller();
|
|
||||||
installer.installTypescriptHook(process.argv[2]);
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
|
@ -1,42 +0,0 @@
|
||||||
/********************************************************
|
|
||||||
* *
|
|
||||||
* Copyright (C) Microsoft. All rights reserved. *
|
|
||||||
* *
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
// Note: cordova.d.ts defines typings for cordova as a cordova app would see it.
|
|
||||||
// This file defines typings as the npm cordova module is used
|
|
||||||
|
|
||||||
declare module "cordova" {
|
|
||||||
import Q = require('q');
|
|
||||||
import http = require('http');
|
|
||||||
|
|
||||||
module Cordova {
|
|
||||||
export interface ICordovaRaw {
|
|
||||||
prepare(options?: any): Q.Promise<any>;
|
|
||||||
build(options?: any): Q.Promise<any>;
|
|
||||||
help: any;
|
|
||||||
config: any;
|
|
||||||
create(dir: string, id?: string, name?: string, cfg?: any): Q.Promise<any>;
|
|
||||||
emulate(options?: any): Q.Promise<any>;
|
|
||||||
plugin(command: any, targets?: any, opts?: any): Q.Promise<any>;
|
|
||||||
plugins(command: any, targets?: any, opts?: any): Q.Promise<any>;
|
|
||||||
serve(port: number): Q.Promise<http.Server>;
|
|
||||||
platform(command: any, targets?: any, opts?: any): Q.Promise<any>;
|
|
||||||
platforms(command: any, targets?: any, opts?: any): Q.Promise<any>;
|
|
||||||
compile(options: any): Q.Promise<any>;
|
|
||||||
run(options?: any): Q.Promise<any>;
|
|
||||||
info(): Q.Promise<any[]>;
|
|
||||||
save(target: any, opts?: any): Q.Promise<any>;
|
|
||||||
restore(target: any, args: any): Q.Promise<any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function on(event: string, ...args: any[]) : void;
|
|
||||||
export function off(event: string, ...args: any[]) : void;
|
|
||||||
export function emit(event: string, ...args: any[]) : void;
|
|
||||||
export function trigger(event: string, ...args: any[]) : void;
|
|
||||||
export var raw: ICordovaRaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
export = Cordova
|
|
||||||
}
|
|
|
@ -1,125 +0,0 @@
|
||||||
// Type definitions for Apache Cordova BatteryStatus plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-battery-status
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
onbatterystatus: (type: BatteryStatusEvent) => void;
|
|
||||||
onbatterycritical: (type: BatteryStatusEvent) => void;
|
|
||||||
onbatterylow: (type: BatteryStatusEvent) => void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param listener the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param listener the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param listener the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param listener the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the BatteryStatus plugin.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* batterystatus: event fires when the percentage of battery charge
|
|
||||||
* changes by at least 1 percent, or if the device is plugged in or unplugged.
|
|
||||||
* batterycritical: event fires when the percentage of battery charge has reached
|
|
||||||
* the critical battery threshold. The value is device-specific.
|
|
||||||
* batterylow: event fires when the percentage of battery charge has
|
|
||||||
* reached the low battery threshold, device-specific value.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an BatteryStatusEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Object, that passed into battery event listener */
|
|
||||||
interface BatteryStatusEvent extends Event {
|
|
||||||
/* The percentage of battery charge (0-100). */
|
|
||||||
level: number;
|
|
||||||
/* A boolean that indicates whether the device is plugged in. */
|
|
||||||
isPlugged: boolean;
|
|
||||||
}
|
|
|
@ -1,174 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Camera plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-camera
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/**
|
|
||||||
* This plugin provides an API for taking pictures and for choosing images from the system's image library.
|
|
||||||
*/
|
|
||||||
camera: Camera;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This plugin provides an API for taking pictures and for choosing images from the system's image library.
|
|
||||||
*/
|
|
||||||
interface Camera {
|
|
||||||
/**
|
|
||||||
* Removes intermediate photos taken by the camera from temporary storage.
|
|
||||||
* @param onSuccess Success callback, that called when cleanup succeeds.
|
|
||||||
* @param onError Error callback, that get an error message.
|
|
||||||
*/
|
|
||||||
cleanup(
|
|
||||||
onSuccess: () => void,
|
|
||||||
onError: (message: string) => void): void;
|
|
||||||
/**
|
|
||||||
* Takes a photo using the camera, or retrieves a photo from the device's image gallery.
|
|
||||||
* @param cameraSuccess Success callback, that get the image
|
|
||||||
* as a base64-encoded String, or as the URI for the image file.
|
|
||||||
* @param cameraError Error callback, that get an error message.
|
|
||||||
* @param cameraOptions Optional parameters to customize the camera settings.
|
|
||||||
*/
|
|
||||||
getPicture(
|
|
||||||
cameraSuccess: (data: string) => void,
|
|
||||||
cameraError: (message: string) => void,
|
|
||||||
cameraOptions?: CameraOptions): void;
|
|
||||||
// Next will work only on iOS
|
|
||||||
//getPicture(
|
|
||||||
// cameraSuccess: (data: string) => void,
|
|
||||||
// cameraError: (message: string) => void,
|
|
||||||
// cameraOptions?: CameraOptions): CameraPopoverHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CameraOptions {
|
|
||||||
/** Picture quality in range 0-100. Default is 50 */
|
|
||||||
quality?: number;
|
|
||||||
/**
|
|
||||||
* Choose the format of the return value.
|
|
||||||
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
|
||||||
* DATA_URL : 0, Return image as base64-encoded string
|
|
||||||
* FILE_URI : 1, Return image file URI
|
|
||||||
* NATIVE_URI : 2 Return image native URI
|
|
||||||
* (e.g., assets-library:// on iOS or content:// on Android)
|
|
||||||
*/
|
|
||||||
destinationType?: number;
|
|
||||||
/**
|
|
||||||
* Set the source of the picture.
|
|
||||||
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
|
|
||||||
* PHOTOLIBRARY : 0,
|
|
||||||
* CAMERA : 1,
|
|
||||||
* SAVEDPHOTOALBUM : 2
|
|
||||||
*/
|
|
||||||
sourceType?: number;
|
|
||||||
/** Allow simple editing of image before selection. */
|
|
||||||
allowEdit?: boolean;
|
|
||||||
/**
|
|
||||||
* Choose the returned image file's encoding.
|
|
||||||
* Defined in navigator.camera.EncodingType. Default is JPEG
|
|
||||||
* JPEG : 0 Return JPEG encoded image
|
|
||||||
* PNG : 1 Return PNG encoded image
|
|
||||||
*/
|
|
||||||
encodingType?: number;
|
|
||||||
/**
|
|
||||||
* Width in pixels to scale image. Must be used with targetHeight.
|
|
||||||
* Aspect ratio remains constant.
|
|
||||||
*/
|
|
||||||
targetWidth?: number;
|
|
||||||
/**
|
|
||||||
* Height in pixels to scale image. Must be used with targetWidth.
|
|
||||||
* Aspect ratio remains constant.
|
|
||||||
*/
|
|
||||||
targetHeight?: number;
|
|
||||||
/**
|
|
||||||
* Set the type of media to select from. Only works when PictureSourceType
|
|
||||||
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
|
|
||||||
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
|
|
||||||
* Will return format specified via DestinationType
|
|
||||||
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
|
||||||
* ALLMEDIA : 2 allow selection from all media types
|
|
||||||
*/
|
|
||||||
mediaType?: number;
|
|
||||||
/** Rotate the image to correct for the orientation of the device during capture. */
|
|
||||||
correctOrientation?: boolean;
|
|
||||||
/** Save the image to the photo album on the device after capture. */
|
|
||||||
saveToPhotoAlbum?: boolean;
|
|
||||||
/**
|
|
||||||
* Choose the camera to use (front- or back-facing).
|
|
||||||
* Defined in navigator.camera.Direction. Default is BACK.
|
|
||||||
* FRONT: 0
|
|
||||||
* BACK: 1
|
|
||||||
*/
|
|
||||||
cameraDirection?: number;
|
|
||||||
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
|
|
||||||
popoverOptions?: CameraPopoverOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A handle to the popover dialog created by navigator.camera.getPicture. Used on iOS only.
|
|
||||||
*/
|
|
||||||
interface CameraPopoverHandle {
|
|
||||||
/**
|
|
||||||
* Set the position of the popover.
|
|
||||||
* @param popoverOptions the CameraPopoverOptions that specify the new position.
|
|
||||||
*/
|
|
||||||
setPosition(popoverOptions: CameraPopoverOptions): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* iOS-only parameters that specify the anchor element location and arrow direction
|
|
||||||
* of the popover when selecting images from an iPad's library or album.
|
|
||||||
*/
|
|
||||||
interface CameraPopoverOptions {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
/**
|
|
||||||
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
|
|
||||||
* Matches iOS UIPopoverArrowDirection constants.
|
|
||||||
* ARROW_UP : 1,
|
|
||||||
* ARROW_DOWN : 2,
|
|
||||||
* ARROW_LEFT : 4,
|
|
||||||
* ARROW_RIGHT : 8,
|
|
||||||
* ARROW_ANY : 15
|
|
||||||
*/
|
|
||||||
arrowDir : number;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Camera: {
|
|
||||||
// Camera constants, defined in Camera plugin
|
|
||||||
DestinationType: {
|
|
||||||
DATA_URL: number;
|
|
||||||
FILE_URI: number;
|
|
||||||
NATIVE_URI: number
|
|
||||||
}
|
|
||||||
Direction: {
|
|
||||||
BACK: number;
|
|
||||||
FRONT: number;
|
|
||||||
}
|
|
||||||
EncodingType: {
|
|
||||||
JPEG: number;
|
|
||||||
PNG: number;
|
|
||||||
}
|
|
||||||
MediaType: {
|
|
||||||
PICTURE: number;
|
|
||||||
VIDEO: number;
|
|
||||||
ALLMEDIA: number;
|
|
||||||
}
|
|
||||||
PictureSourceType: {
|
|
||||||
PHOTOLIBRARY: number;
|
|
||||||
CAMERA: number;
|
|
||||||
SAVEDPHOTOALBUM: number;
|
|
||||||
}
|
|
||||||
// Used only on iOS
|
|
||||||
PopoverArrowDirection: {
|
|
||||||
ARROW_UP: number;
|
|
||||||
ARROW_DOWN: number;
|
|
||||||
ARROW_LEFT: number;
|
|
||||||
ARROW_RIGHT: number;
|
|
||||||
ARROW_ANY: number;
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,273 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Contacts plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-contacts
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/** Provides access to the device contacts database. */
|
|
||||||
contacts: Contacts;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Contacts {
|
|
||||||
/**
|
|
||||||
* The navigator.contacts.create method is synchronous, and returns a new Contact object.
|
|
||||||
* This method does not retain the Contact object in the device contacts database,
|
|
||||||
* for which you need to invoke the Contact.save method.
|
|
||||||
* @param properties Object with contact fields
|
|
||||||
*/
|
|
||||||
create(properties?: ContactProperties): Contact;
|
|
||||||
/**
|
|
||||||
* The navigator.contacts.find method executes asynchronously, querying the device contacts database
|
|
||||||
* and returning an array of Contact objects. The resulting objects are passed to the onSuccess
|
|
||||||
* callback function specified by the onSuccess parameter.
|
|
||||||
* @param fields The fields parameter specifies the fields to be used as a search qualifier,
|
|
||||||
* and only those results are passed to the onSuccess callback function. A zero-length fields parameter
|
|
||||||
* is invalid and results in ContactError.INVALID_ARGUMENT_ERROR. A contactFields value of "*" returns all contact fields.
|
|
||||||
* @param onSuccess Success callback function invoked with the array of Contact objects returned from the database
|
|
||||||
* @param onError Error callback function, invoked when an error occurs.
|
|
||||||
* @param options Search options to filter navigator.contacts.
|
|
||||||
*/
|
|
||||||
find(fields: string[],
|
|
||||||
onSuccess: (contacts: Contact[]) => void,
|
|
||||||
onError: (error: ContactError) => void,
|
|
||||||
options?: ContactFindOptions): void;
|
|
||||||
/**
|
|
||||||
* The navigator.contacts.pickContact method launches the Contact Picker to select a single contact.
|
|
||||||
* The resulting object is passed to the contactSuccess callback function specified by the contactSuccess parameter.
|
|
||||||
* @param onSuccess Success callback function invoked with the array of Contact objects returned from the database
|
|
||||||
* @param onError Error callback function, invoked when an error occurs.
|
|
||||||
*/
|
|
||||||
pickContact(onSuccess: (contact: Contact) => void,
|
|
||||||
onError: (error: ContactError) => void): void
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ContactProperties {
|
|
||||||
/** A globally unique identifier. */
|
|
||||||
id?: string;
|
|
||||||
/** The name of this Contact, suitable for display to end users. */
|
|
||||||
displayName?: string;
|
|
||||||
/** An object containing all components of a persons name. */
|
|
||||||
name?: ContactName;
|
|
||||||
/** A casual name by which to address the contact. */
|
|
||||||
nickname?: string;
|
|
||||||
/** An array of all the contact's phone numbers. */
|
|
||||||
phoneNumbers?: ContactField[];
|
|
||||||
/** An array of all the contact's email addresses. */
|
|
||||||
emails?: ContactField[];
|
|
||||||
/** An array of all the contact's addresses. */
|
|
||||||
addresses?: ContactAddress[];
|
|
||||||
/** An array of all the contact's IM addresses. */
|
|
||||||
ims?: ContactField[];
|
|
||||||
/** An array of all the contact's organizations. */
|
|
||||||
organizations?: ContactOrganization[];
|
|
||||||
/** The birthday of the contact. */
|
|
||||||
birthday?: Date;
|
|
||||||
/** A note about the contact. */
|
|
||||||
note?: string;
|
|
||||||
/** An array of the contact's photos. */
|
|
||||||
photos?: ContactField[];
|
|
||||||
/** An array of all the user-defined categories associated with the contact. */
|
|
||||||
categories?: ContactField[];
|
|
||||||
/** An array of web pages associated with the contact. */
|
|
||||||
urls?: ContactField[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Contact object represents a user's contact. Contacts can be created, stored, or removed
|
|
||||||
* from the device contacts database. Contacts can also be retrieved (individually or in bulk)
|
|
||||||
* from the database by invoking the navigator.contacts.find method.
|
|
||||||
*/
|
|
||||||
interface Contact extends ContactProperties {
|
|
||||||
/**
|
|
||||||
* Returns a new Contact object that is a deep copy of the calling object, with the id property set to null
|
|
||||||
*/
|
|
||||||
clone(): Contact;
|
|
||||||
/**
|
|
||||||
* Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object.
|
|
||||||
* @param onSuccess Success callback function invoked on success operation.
|
|
||||||
* @param onError Error callback function, invoked when an error occurs.
|
|
||||||
*/
|
|
||||||
remove(
|
|
||||||
onSuccess: () => void,
|
|
||||||
onError: (error: Error) => void): void;
|
|
||||||
/**
|
|
||||||
* Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists.
|
|
||||||
* @param onSuccess Success callback function invoked on success operation with che Contact object.
|
|
||||||
* @param onError Error callback function, invoked when an error occurs.
|
|
||||||
*/
|
|
||||||
save(
|
|
||||||
onSuccess: (contact: Contact) => void,
|
|
||||||
onError: (error: Error) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Contact: {
|
|
||||||
/** Constructor of Contact object */
|
|
||||||
new(id?: string,
|
|
||||||
displayName?: string,
|
|
||||||
name?: ContactName,
|
|
||||||
nickname?: string,
|
|
||||||
phoneNumbers?: ContactField[],
|
|
||||||
emails?: ContactField[],
|
|
||||||
addresses?: ContactAddress[],
|
|
||||||
ims?: ContactField[],
|
|
||||||
organizations?: ContactOrganization[],
|
|
||||||
birthday?: Date,
|
|
||||||
note?: string,
|
|
||||||
photos?: ContactField[],
|
|
||||||
categories?: ContactField,
|
|
||||||
urls?: ContactField[]): Contact
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The ContactError object is returned to the user through the contactError callback function when an error occurs. */
|
|
||||||
interface ContactError {
|
|
||||||
/** Error code */
|
|
||||||
code: number;
|
|
||||||
/** Error message */
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ContactError: {
|
|
||||||
new(code: number): ContactError;
|
|
||||||
UNKNOWN_ERROR: number;
|
|
||||||
INVALID_ARGUMENT_ERROR: number;
|
|
||||||
TIMEOUT_ERROR: number;
|
|
||||||
PENDING_OPERATION_ERROR: number;
|
|
||||||
IO_ERROR: number;
|
|
||||||
NOT_SUPPORTED_ERROR: number;
|
|
||||||
PERMISSION_DENIED_ERROR: number
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Contains different kinds of information about a Contact object's name. */
|
|
||||||
interface ContactName {
|
|
||||||
/** The complete name of the contact. */
|
|
||||||
formatted?: string;
|
|
||||||
/** The contact's family name. */
|
|
||||||
familyName?: string;
|
|
||||||
/** The contact's given name. */
|
|
||||||
givenName?: string;
|
|
||||||
/** The contact's middle name. */
|
|
||||||
middleName?: string;
|
|
||||||
/** The contact's prefix (example Mr. or Dr.) */
|
|
||||||
honorificPrefix?: string;
|
|
||||||
/** The contact's suffix (example Esq.). */
|
|
||||||
honorificSuffix?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ContactName: {
|
|
||||||
/** Constructor for ContactName object */
|
|
||||||
new(formatted?: string,
|
|
||||||
familyName?: string,
|
|
||||||
givenName?: string,
|
|
||||||
middleName?: string,
|
|
||||||
honorificPrefix?: string,
|
|
||||||
honorificSuffix?: string): ContactName
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ContactField object is a reusable component that represents contact fields generically.
|
|
||||||
* Each ContactField object contains a value, type, and pref property. A Contact object stores
|
|
||||||
* several properties in ContactField[] arrays, such as phone numbers and email addresses.
|
|
||||||
*
|
|
||||||
* In most instances, there are no pre-determined values for a ContactField object's type attribute.
|
|
||||||
* For example, a phone number can specify type values of home, work, mobile, iPhone,
|
|
||||||
* or any other value that is supported by a particular device platform's contact database.
|
|
||||||
* However, for the Contact photos field, the type field indicates the format of the returned image:
|
|
||||||
* url when the value attribute contains a URL to the photo image, or base64 when the value
|
|
||||||
* contains a base64-encoded image string.
|
|
||||||
*/
|
|
||||||
interface ContactField {
|
|
||||||
/** A string that indicates what type of field this is, home for example. */
|
|
||||||
type: string;
|
|
||||||
/** The value of the field, such as a phone number or email address. */
|
|
||||||
value: string;
|
|
||||||
/** Set to true if this ContactField contains the user's preferred value. */
|
|
||||||
pref: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ContactField: {
|
|
||||||
/** Constructor for ContactField object */
|
|
||||||
new(type?: string,
|
|
||||||
value?: string,
|
|
||||||
pref?: boolean): ContactField
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ContactAddress object stores the properties of a single address of a contact.
|
|
||||||
* A Contact object may include more than one address in a ContactAddress[] array.
|
|
||||||
*/
|
|
||||||
interface ContactAddress {
|
|
||||||
/** Set to true if this ContactAddress contains the user's preferred value. */
|
|
||||||
pref?: boolean;
|
|
||||||
/** A string indicating what type of field this is, home for example. */
|
|
||||||
type?: string;
|
|
||||||
/** The full address formatted for display. */
|
|
||||||
formatted?: string;
|
|
||||||
/** The full street address. */
|
|
||||||
streetAddress?: string;
|
|
||||||
/** The city or locality. */
|
|
||||||
locality?: string;
|
|
||||||
/** The state or region. */
|
|
||||||
region?: string;
|
|
||||||
/** The zip code or postal code. */
|
|
||||||
postalCode?: string;
|
|
||||||
/** The country name. */
|
|
||||||
country?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ContactAddress: {
|
|
||||||
/** Constructor of ContactAddress object */
|
|
||||||
new(pref?: boolean,
|
|
||||||
type?: string,
|
|
||||||
formatted?: string,
|
|
||||||
streetAddress?: string,
|
|
||||||
locality?: string,
|
|
||||||
region?: string,
|
|
||||||
postalCode?: string,
|
|
||||||
country?: string): ContactAddress
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ContactOrganization object stores a contact's organization properties. A Contact object stores
|
|
||||||
* one or more ContactOrganization objects in an array.
|
|
||||||
*/
|
|
||||||
interface ContactOrganization {
|
|
||||||
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
|
||||||
pref?: boolean;
|
|
||||||
/** A string that indicates what type of field this is, home for example. */
|
|
||||||
type?: string;
|
|
||||||
/** The name of the organization. */
|
|
||||||
name?: string;
|
|
||||||
/** The department the contract works for. */
|
|
||||||
department?: string;
|
|
||||||
/** The contact's title at the organization. */
|
|
||||||
title?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ContactOrganization: {
|
|
||||||
/** Constructor for ContactOrganization object */
|
|
||||||
new(pref?: boolean,
|
|
||||||
type?: string,
|
|
||||||
name?: string,
|
|
||||||
department?: string,
|
|
||||||
title?: string): ContactOrganization
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Search options to filter navigator.contacts. */
|
|
||||||
interface ContactFindOptions {
|
|
||||||
/** The search string used to find navigator.contacts. */
|
|
||||||
filter?: string;
|
|
||||||
/** Determines if the find operation returns multiple navigator.contacts. */
|
|
||||||
multiple?: boolean;
|
|
||||||
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
|
|
||||||
desiredFields?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ContactFindOptions: {
|
|
||||||
/** Constructor for ContactFindOptions object */
|
|
||||||
new(filter?: string,
|
|
||||||
multiple?: boolean,
|
|
||||||
desiredFields?: string[]): ContactFindOptions
|
|
||||||
};
|
|
|
@ -1,31 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Device plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-device
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This plugin defines a global device object, which describes the device's hardware and software.
|
|
||||||
* Although the object is in the global scope, it is not available until after the deviceready event.
|
|
||||||
*/
|
|
||||||
interface Device {
|
|
||||||
/** Get the version of Cordova running on the device. */
|
|
||||||
cordova: string;
|
|
||||||
/**
|
|
||||||
* The device.model returns the name of the device's model or product. The value is set
|
|
||||||
* by the device manufacturer and may be different across versions of the same product.
|
|
||||||
*/
|
|
||||||
model: string;
|
|
||||||
/** device.name is deprecated as of version 2.3.0. Use device.model instead. */
|
|
||||||
name: string;
|
|
||||||
/** Get the device's operating system name. */
|
|
||||||
platform: string;
|
|
||||||
/** Get the device's Universally Unique Identifier (UUID). */
|
|
||||||
uuid: string;
|
|
||||||
/** Get the operating system version. */
|
|
||||||
version: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var device: Device;
|
|
|
@ -1,77 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Device Motion plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-device-motion
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/**
|
|
||||||
* This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor
|
|
||||||
* that detects the change (delta) in movement relative to the current device orientation,
|
|
||||||
* in three dimensions along the x, y, and z axis.
|
|
||||||
*/
|
|
||||||
accelerometer: Accelerometer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor
|
|
||||||
* that detects the change (delta) in movement relative to the current device orientation,
|
|
||||||
* in three dimensions along the x, y, and z axis.
|
|
||||||
*/
|
|
||||||
interface Accelerometer {
|
|
||||||
/**
|
|
||||||
* Stop watching the Acceleration referenced by the watchID parameter.
|
|
||||||
* @param watchID The ID returned by navigator.accelerometer.watchAcceleration.
|
|
||||||
*/
|
|
||||||
clearWatch(watchID: WatchHandle): void;
|
|
||||||
/**
|
|
||||||
* Get the current acceleration along the x, y, and z axes.
|
|
||||||
* These acceleration values are returned to the accelerometerSuccess callback function.
|
|
||||||
* @param accelerometerSuccess Success callback that gets the Acceleration object.
|
|
||||||
* @param accelerometerError Success callback
|
|
||||||
*/
|
|
||||||
getCurrentAcceleration(
|
|
||||||
accelerometerSuccess: (acceleration: Acceleration) => void,
|
|
||||||
accelerometerError: () => void): void;
|
|
||||||
/**
|
|
||||||
* Retrieves the device's current Acceleration at a regular interval, executing the
|
|
||||||
* accelerometerSuccess callback function each time. Specify the interval in milliseconds
|
|
||||||
* via the acceleratorOptions object's frequency parameter.
|
|
||||||
* The returned watch ID references the accelerometer's watch interval, and can be used
|
|
||||||
* with navigator.accelerometer.clearWatch to stop watching the accelerometer.
|
|
||||||
* @param accelerometerSuccess Callback, that called at every time interval and passes an Acceleration object.
|
|
||||||
* @param accelerometerError Error callback.
|
|
||||||
* @param accelerometerOptions Object with options for watchAcceleration
|
|
||||||
*/
|
|
||||||
watchAcceleration(
|
|
||||||
accelerometerSuccess: (acceleration: Acceleration) => void,
|
|
||||||
accelerometerError: () => void,
|
|
||||||
accelerometerOptions?: AccelerometerOptions): WatchHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains Accelerometer data captured at a specific point in time. Acceleration values include
|
|
||||||
* the effect of gravity (9.81 m/s^2), so that when a device lies flat and facing up, x, y, and z
|
|
||||||
* values returned should be 0, 0, and 9.81.
|
|
||||||
*/
|
|
||||||
interface Acceleration {
|
|
||||||
/** Amount of acceleration on the x-axis. (in m/s^2) */
|
|
||||||
x: number;
|
|
||||||
/** Amount of acceleration on the y-axis. (in m/s^2) */
|
|
||||||
y: number;
|
|
||||||
/** Amount of acceleration on the z-axis. (in m/s^2) */
|
|
||||||
z: number;
|
|
||||||
/** Creation timestamp in milliseconds. */
|
|
||||||
timestamp: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Object with options for watchAcceleration */
|
|
||||||
interface AccelerometerOptions {
|
|
||||||
/** How often to retrieve the Acceleration in milliseconds. (Default: 10000) */
|
|
||||||
frequency?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Abstract type for watch IDs used by Accelerometer. Values of these type are actually `number` at runtime.*/
|
|
||||||
interface WatchHandle { }
|
|
|
@ -1,86 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Device Orientation plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-device-orientation
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/**
|
|
||||||
* This plugin provides access to the device's compass. The compass is a sensor that detects
|
|
||||||
* the direction or heading that the device is pointed, typically from the top of the device.
|
|
||||||
* It measures the heading in degrees from 0 to 359.99, where 0 is north.
|
|
||||||
*/
|
|
||||||
compass: Compass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This plugin provides access to the device's compass. The compass is a sensor that detects
|
|
||||||
* the direction or heading that the device is pointed, typically from the top of the device.
|
|
||||||
* It measures the heading in degrees from 0 to 359.99, where 0 is north.
|
|
||||||
*/
|
|
||||||
interface Compass {
|
|
||||||
/**
|
|
||||||
* Get the current compass heading. The compass heading is returned via a CompassHeading
|
|
||||||
* object using the onSuccess callback function.
|
|
||||||
* @param onSuccess Success callback that passes CompassHeading object.
|
|
||||||
* @param onError Error callback that passes CompassError object.
|
|
||||||
*/
|
|
||||||
getCurrentHeading(
|
|
||||||
onSuccess: (heading: CompassHeading) => void,
|
|
||||||
onError: (error: CompassError) => void,
|
|
||||||
options?: CompassOptions): void;
|
|
||||||
/**
|
|
||||||
* Gets the device's current heading at a regular interval. Each time the heading is retrieved,
|
|
||||||
* the headingSuccess callback function is executed. The returned watch ID references the compass
|
|
||||||
* watch interval. The watch ID can be used with navigator.compass.clearWatch to stop watching
|
|
||||||
* the navigator.compass.
|
|
||||||
* @param onSuccess Success callback that passes CompassHeading object.
|
|
||||||
* @param onError Error callback that passes CompassError object.
|
|
||||||
* @param options CompassOptions object
|
|
||||||
*/
|
|
||||||
watchHeading(
|
|
||||||
onSuccess: (heading: CompassHeading) => void,
|
|
||||||
onError: (error: CompassError) => void,
|
|
||||||
options?: CompassOptions): number;
|
|
||||||
/**
|
|
||||||
* Stop watching the compass referenced by the watch ID parameter.
|
|
||||||
* @param id The ID returned by navigator.compass.watchHeading.
|
|
||||||
*/
|
|
||||||
clearWatch(id: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A CompassHeading object is returned to the compassSuccess callback function. */
|
|
||||||
interface CompassHeading {
|
|
||||||
/** The heading in degrees from 0-359.99 at a single moment in time. */
|
|
||||||
magneticHeading: number;
|
|
||||||
/** The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. */
|
|
||||||
trueHeading: number;
|
|
||||||
/** The deviation in degrees between the reported heading and the true heading. */
|
|
||||||
headingAccuracy: number;
|
|
||||||
/** The time at which this heading was determined. */
|
|
||||||
timestamp: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CompassOptions {
|
|
||||||
filter?: number;
|
|
||||||
frequency?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A CompassError object is returned to the onError callback function when an error occurs. */
|
|
||||||
interface CompassError {
|
|
||||||
/**
|
|
||||||
* One of the predefined error codes
|
|
||||||
* CompassError.COMPASS_INTERNAL_ERR
|
|
||||||
* CompassError.COMPASS_NOT_SUPPORTED
|
|
||||||
*/
|
|
||||||
code: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var CompassError: {
|
|
||||||
/** Constructor for CompassError object */
|
|
||||||
new(code: number): CompassError;
|
|
||||||
COMPASS_INTERNAL_ERR: number;
|
|
||||||
COMPASS_NOT_SUPPORTED: number
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Dialogs plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-dialogs
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/** This plugin provides access to some native dialog UI elements. */
|
|
||||||
notification: Notification
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This plugin provides access to some native dialog UI elements. */
|
|
||||||
interface Notification {
|
|
||||||
/**
|
|
||||||
* Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature,
|
|
||||||
* but some platforms use the browser's alert function, which is typically less customizable.
|
|
||||||
* @param message Dialog message.
|
|
||||||
* @param alertCallback Callback to invoke when alert dialog is dismissed.
|
|
||||||
* @param title Dialog title, defaults to 'Alert'.
|
|
||||||
* @param buttonName Button name, defaults to OK.
|
|
||||||
*/
|
|
||||||
alert(message: string,
|
|
||||||
alertCallback: () => void,
|
|
||||||
title?: string,
|
|
||||||
buttonName?: string): void;
|
|
||||||
/**
|
|
||||||
* The device plays a beep sound.
|
|
||||||
* @param times The number of times to repeat the beep.
|
|
||||||
*/
|
|
||||||
beep(times: number): void;
|
|
||||||
/**
|
|
||||||
* Displays a customizable confirmation dialog box.
|
|
||||||
* @param message Dialog message.
|
|
||||||
* @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3)
|
|
||||||
* or when the dialog is dismissed without a button press (0).
|
|
||||||
* @param title Dialog title, defaults to Confirm.
|
|
||||||
* @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel].
|
|
||||||
*/
|
|
||||||
confirm(message: string,
|
|
||||||
confirmCallback: (choice: number) => void,
|
|
||||||
title?: string,
|
|
||||||
buttonLabels?: string[]): void;
|
|
||||||
/**
|
|
||||||
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
|
||||||
* @param message Dialog message.
|
|
||||||
* @param promptCallback Callback to invoke when a button is pressed.
|
|
||||||
* @param title Dialog title, defaults to "Prompt".
|
|
||||||
* @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"].
|
|
||||||
* @param defaultText Default textbox input value, default: "".
|
|
||||||
*/
|
|
||||||
prompt(message: string,
|
|
||||||
promptCallback: (result: NotificationPromptResult) => void,
|
|
||||||
title?: string,
|
|
||||||
buttonLabels?: string[],
|
|
||||||
defaultText?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Object, passed to promptCallback */
|
|
||||||
interface NotificationPromptResult {
|
|
||||||
/**
|
|
||||||
* The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
|
|
||||||
* 0 is the result when the dialog is dismissed without a button press.
|
|
||||||
*/
|
|
||||||
buttonIndex: number;
|
|
||||||
/** The text entered in the prompt dialog box. */
|
|
||||||
input1: string;
|
|
||||||
}
|
|
|
@ -1,364 +0,0 @@
|
||||||
// Type definitions for Apache Cordova File System plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-file
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
/**
|
|
||||||
* Requests a filesystem in which to store application data.
|
|
||||||
* @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT.
|
|
||||||
* @param size This is an indicator of how much storage space, in bytes, the application expects to need.
|
|
||||||
* @param successCallback The callback that is called when the user agent provides a filesystem.
|
|
||||||
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
|
|
||||||
*/
|
|
||||||
requestFileSystem(
|
|
||||||
type: number,
|
|
||||||
size: number,
|
|
||||||
successCallback: (fileSystem: FileSystem) => void,
|
|
||||||
errorCallback?: (fileError: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Look up file system Entry referred to by local URI.
|
|
||||||
* @param string uri URI referring to a local file or directory
|
|
||||||
* @param successCallback invoked with Entry object corresponding to URI
|
|
||||||
* @param errorCallback invoked if error occurs retrieving file system entry
|
|
||||||
*/
|
|
||||||
resolveLocalFileSystemURI(uri: string,
|
|
||||||
successCallback: (entry: Entry) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
TEMPORARY: number;
|
|
||||||
PERSISTENT: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This interface represents a file system. */
|
|
||||||
interface FileSystem {
|
|
||||||
/* The name of the file system, unique across the list of exposed file systems. */
|
|
||||||
name: string;
|
|
||||||
/** The root directory of the file system. */
|
|
||||||
root: DirectoryEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An abstract interface representing entries in a file system,
|
|
||||||
* each of which may be a File or DirectoryEntry.
|
|
||||||
*/
|
|
||||||
interface Entry {
|
|
||||||
/** Entry is a file. */
|
|
||||||
isFile: boolean;
|
|
||||||
/** Entry is a directory. */
|
|
||||||
isDirectory: boolean;
|
|
||||||
/** The name of the entry, excluding the path leading to it. */
|
|
||||||
name: string;
|
|
||||||
/** The full absolute path from the root to the entry. */
|
|
||||||
fullPath: string;
|
|
||||||
/** The file system on which the entry resides. */
|
|
||||||
fileSystem: FileSystem;
|
|
||||||
nativeURL: string;
|
|
||||||
/**
|
|
||||||
* Look up metadata about this entry.
|
|
||||||
* @param successCallback A callback that is called with the time of the last modification.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
getMetadata(
|
|
||||||
successCallback: (metadata: Metadata) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Move an entry to a different location on the file system. It is an error to try to:
|
|
||||||
* move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided;
|
|
||||||
* move a file to a path occupied by a directory;
|
|
||||||
* move a directory to a path occupied by a file;
|
|
||||||
* move any element to a path occupied by a directory which is not empty.
|
|
||||||
* A move of a file on top of an existing file must attempt to delete and replace that file.
|
|
||||||
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
|
|
||||||
* @param parent The directory to which to move the entry.
|
|
||||||
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
|
|
||||||
* @param successCallback A callback that is called with the Entry for the new location.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
moveTo(parent: DirectoryEntry,
|
|
||||||
newName?: string,
|
|
||||||
successCallback?: (entry: Entry) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Copy an entry to a different location on the file system. It is an error to try to:
|
|
||||||
* copy a directory inside itself or to any child at any depth;
|
|
||||||
* copy an entry into its parent if a name different from its current one isn't provided;
|
|
||||||
* copy a file to a path occupied by a directory;
|
|
||||||
* copy a directory to a path occupied by a file;
|
|
||||||
* copy any element to a path occupied by a directory which is not empty.
|
|
||||||
* A copy of a file on top of an existing file must attempt to delete and replace that file.
|
|
||||||
* A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.
|
|
||||||
* Directory copies are always recursive--that is, they copy all contents of the directory.
|
|
||||||
* @param parent The directory to which to move the entry.
|
|
||||||
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
|
|
||||||
* @param successCallback A callback that is called with the Entry for the new object.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
copyTo(parent: DirectoryEntry,
|
|
||||||
newName?: string,
|
|
||||||
successCallback?: (entry: Entry) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Returns a URL that can be used as the src attribute of a <video> or <audio> tag.
|
|
||||||
* If that is not possible, construct a cdvfile:// URL.
|
|
||||||
* @return string URL
|
|
||||||
*/
|
|
||||||
toURL(): string;
|
|
||||||
/**
|
|
||||||
* Return a URL that can be passed across the bridge to identify this entry.
|
|
||||||
* @return string URL that can be passed across the bridge to identify this entry
|
|
||||||
*/
|
|
||||||
toInternalURL(): string;
|
|
||||||
/**
|
|
||||||
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
|
|
||||||
* @param successCallback A callback that is called on success.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
remove(successCallback: () => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.
|
|
||||||
* @param successCallback A callback that is called with the time of the last modification.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
getParent(successCallback: (entry: Entry) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This interface supplies information about the state of a file or directory. */
|
|
||||||
interface Metadata {
|
|
||||||
/** This is the time at which the file or directory was last modified. */
|
|
||||||
modificationTime: Date;
|
|
||||||
/** The size of the file, in bytes. This must return 0 for directories. */
|
|
||||||
size: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This interface represents a directory on a file system. */
|
|
||||||
interface DirectoryEntry extends Entry {
|
|
||||||
/**
|
|
||||||
* Creates a new DirectoryReader to read Entries from this Directory.
|
|
||||||
*/
|
|
||||||
createReader(): DirectoryReader;
|
|
||||||
/**
|
|
||||||
* Creates or looks up a file.
|
|
||||||
* @param path Either an absolute path or a relative path from this DirectoryEntry
|
|
||||||
* to the file to be looked up or created.
|
|
||||||
* It is an error to attempt to create a file whose immediate parent does not yet exist.
|
|
||||||
* @param options If create and exclusive are both true, and the path already exists, getFile must fail.
|
|
||||||
* If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.
|
|
||||||
* If create is not true and the path doesn't exist, getFile must fail.
|
|
||||||
* If create is not true and the path exists, but is a directory, getFile must fail.
|
|
||||||
* Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
|
|
||||||
* @param successCallback A callback that is called to return the File selected or created.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
getFile(path: string, options?: Flags,
|
|
||||||
successCallback?: (entry: FileEntry) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Creates or looks up a directory.
|
|
||||||
* @param path Either an absolute path or a relative path from this DirectoryEntry
|
|
||||||
* to the directory to be looked up or created.
|
|
||||||
* It is an error to attempt to create a directory whose immediate parent does not yet exist.
|
|
||||||
* @param options If create and exclusive are both true and the path already exists, getDirectory must fail.
|
|
||||||
* If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.
|
|
||||||
* If create is not true and the path doesn't exist, getDirectory must fail.
|
|
||||||
* If create is not true and the path exists, but is a file, getDirectory must fail.
|
|
||||||
* Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
|
|
||||||
* @param successCallback A callback that is called to return the Directory selected or created.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
getDirectory(path: string, options?: Flags,
|
|
||||||
successCallback?: (entry: DirectoryEntry) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Deletes a directory and all of its contents, if any. In the event of an error (e.g. trying
|
|
||||||
* to delete a directory that contains a file that cannot be removed), some of the contents
|
|
||||||
* of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
|
|
||||||
* @param successCallback A callback that is called on success.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
removeRecursively(successCallback: () => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This dictionary is used to supply arguments to methods
|
|
||||||
* that look up or create files or directories.
|
|
||||||
*/
|
|
||||||
interface Flags {
|
|
||||||
/** Used to indicate that the user wants to create a file or directory if it was not previously there. */
|
|
||||||
create?: boolean;
|
|
||||||
/** By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists. */
|
|
||||||
exclusive?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This interface lets a user list files and directories in a directory. If there are
|
|
||||||
* no additions to or deletions from a directory between the first and last call to
|
|
||||||
* readEntries, and no errors occur, then:
|
|
||||||
* A series of calls to readEntries must return each entry in the directory exactly once.
|
|
||||||
* Once all entries have been returned, the next call to readEntries must produce an empty array.
|
|
||||||
* If not all entries have been returned, the array produced by readEntries must not be empty.
|
|
||||||
* The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
|
|
||||||
*/
|
|
||||||
interface DirectoryReader {
|
|
||||||
/**
|
|
||||||
* Read the next block of entries from this directory.
|
|
||||||
* @param successCallback Called once per successful call to readEntries to deliver the next
|
|
||||||
* previously-unreported set of Entries in the associated Directory.
|
|
||||||
* If all Entries have already been returned from previous invocations
|
|
||||||
* of readEntries, successCallback must be called with a zero-length array as an argument.
|
|
||||||
* @param errorCallback A callback indicating that there was an error reading from the Directory.
|
|
||||||
*/
|
|
||||||
readEntries(
|
|
||||||
successCallback: (entries: Entry[]) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This interface represents a file on a file system. */
|
|
||||||
interface FileEntry extends Entry {
|
|
||||||
/**
|
|
||||||
* Creates a new FileWriter associated with the file that this FileEntry represents.
|
|
||||||
* @param successCallback A callback that is called with the new FileWriter.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
createWriter(successCallback: (
|
|
||||||
writer: FileWriter) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
/**
|
|
||||||
* Returns a File that represents the current state of the file that this FileEntry represents.
|
|
||||||
* @param successCallback A callback that is called with the File.
|
|
||||||
* @param errorCallback A callback that is called when errors happen.
|
|
||||||
*/
|
|
||||||
file(successCallback: (file: File) => void,
|
|
||||||
errorCallback?: (error: FileError) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This interface provides methods to monitor the asynchronous writing of blobs
|
|
||||||
* to disk using progress events and event handler attributes.
|
|
||||||
*/
|
|
||||||
interface FileSaver extends EventTarget {
|
|
||||||
/** Terminate file operation */
|
|
||||||
abort(): void;
|
|
||||||
/**
|
|
||||||
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting,
|
|
||||||
* must return the current state, which must be one of the following values:
|
|
||||||
* INIT
|
|
||||||
* WRITING
|
|
||||||
* DONE
|
|
||||||
*/
|
|
||||||
readyState: number;
|
|
||||||
/** Handler for writestart events. */
|
|
||||||
onwritestart: (event: ProgressEvent) => void;
|
|
||||||
/** Handler for progress events. */
|
|
||||||
onprogress: (event: ProgressEvent) => void;
|
|
||||||
/** Handler for write events. */
|
|
||||||
onwrite: (event: ProgressEvent) => void;
|
|
||||||
/** Handler for abort events. */
|
|
||||||
onabort: (event: ProgressEvent) => void;
|
|
||||||
/** Handler for error events. */
|
|
||||||
onerror: (event: ProgressEvent) => void;
|
|
||||||
/** Handler for writeend events. */
|
|
||||||
onwriteend: (event: ProgressEvent) => void;
|
|
||||||
/** The last error that occurred on the FileSaver. */
|
|
||||||
error: Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This interface expands on the FileSaver interface to allow for multiple write
|
|
||||||
* actions, rather than just saving a single Blob.
|
|
||||||
*/
|
|
||||||
interface FileWriter extends FileSaver {
|
|
||||||
/**
|
|
||||||
* The byte offset at which the next write to the file will occur. This always less or equal than length.
|
|
||||||
* A newly-created FileWriter will have position set to 0.
|
|
||||||
*/
|
|
||||||
position: number;
|
|
||||||
/**
|
|
||||||
* The length of the file. If the user does not have read access to the file,
|
|
||||||
* this will be the highest byte offset at which the user has written.
|
|
||||||
*/
|
|
||||||
length: number;
|
|
||||||
/**
|
|
||||||
* Write the supplied data to the file at position.
|
|
||||||
* @param {Blob} data The blob to write.
|
|
||||||
*/
|
|
||||||
write(data: Blob): void;
|
|
||||||
/**
|
|
||||||
* The file position at which the next write will occur.
|
|
||||||
* @param offset If nonnegative, an absolute byte offset into the file.
|
|
||||||
* If negative, an offset back from the end of the file.
|
|
||||||
*/
|
|
||||||
seek(offset: number): void;
|
|
||||||
/**
|
|
||||||
* Changes the length of the file to that specified. If shortening the file, data beyond the new length
|
|
||||||
* will be discarded. If extending the file, the existing data will be zero-padded up to the new length.
|
|
||||||
* @param size The size to which the length of the file is to be adjusted, measured in bytes.
|
|
||||||
*/
|
|
||||||
truncate(size: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FileWriter states */
|
|
||||||
declare var FileWriter: {
|
|
||||||
INIT: number;
|
|
||||||
WRITING: number;
|
|
||||||
DONE: number
|
|
||||||
};
|
|
||||||
|
|
||||||
interface FileError {
|
|
||||||
/** Error code */
|
|
||||||
code: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var FileError: {
|
|
||||||
new (code: number): FileError;
|
|
||||||
NOT_FOUND_ERR: number;
|
|
||||||
SECURITY_ERR: number;
|
|
||||||
ABORT_ERR: number;
|
|
||||||
NOT_READABLE_ERR: number;
|
|
||||||
ENCODING_ERR: number;
|
|
||||||
NO_MODIFICATION_ALLOWED_ERR: number;
|
|
||||||
INVALID_STATE_ERR: number;
|
|
||||||
SYNTAX_ERR: number;
|
|
||||||
INVALID_MODIFICATION_ERR: number;
|
|
||||||
QUOTA_EXCEEDED_ERR: number;
|
|
||||||
TYPE_MISMATCH_ERR: number;
|
|
||||||
PATH_EXISTS_ERR: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Constants defined in fileSystemPaths
|
|
||||||
*/
|
|
||||||
interface Cordova {
|
|
||||||
file: {
|
|
||||||
/* Read-only directory where the application is installed. */
|
|
||||||
applicationDirectory: string;
|
|
||||||
/* Root of app's private writable storage */
|
|
||||||
applicationStorageDirectory: string;
|
|
||||||
/* Where to put app-specific data files. */
|
|
||||||
dataDirectory: string;
|
|
||||||
/* Cached files that should survive app restarts. Apps should not rely on the OS to delete files in here. */
|
|
||||||
cacheDirectory: string;
|
|
||||||
/* Android: the application space on external storage. */
|
|
||||||
externalApplicationStorageDirectory: string;
|
|
||||||
/* Android: Where to put app-specific data files on external storage. */
|
|
||||||
externalDataDirectory: string;
|
|
||||||
/* Android: the application cache on external storage. */
|
|
||||||
externalCacheDirectory: string;
|
|
||||||
/* Android: the external storage (SD card) root. */
|
|
||||||
externalRootDirectory: string;
|
|
||||||
/* iOS: Temp directory that the OS can clear at will. */
|
|
||||||
tempDirectory: string;
|
|
||||||
/* iOS: Holds app-specific files that should be synced (e.g. to iCloud). */
|
|
||||||
syncedDataDirectory: string;
|
|
||||||
/* iOS: Files private to the app, but that are meaningful to other applciations (e.g. Office files) */
|
|
||||||
documentsDirectory: string;
|
|
||||||
/* BlackBerry10: Files globally available to all apps */
|
|
||||||
sharedDirectory: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
// Type definitions for Apache Cordova FileTransfer plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-file-transfer
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
/// <reference path="FileSystem.d.ts"/>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The FileTransfer object provides a way to upload files using an HTTP multi-part POST request,
|
|
||||||
* and to download files as well.
|
|
||||||
*/
|
|
||||||
interface FileTransfer {
|
|
||||||
/** Called with a ProgressEvent whenever a new chunk of data is transferred. */
|
|
||||||
onprogress: (event: ProgressEvent) => void;
|
|
||||||
/**
|
|
||||||
* Sends a file to a server.
|
|
||||||
* @param fileURL Filesystem URL representing the file on the device. For backwards compatibility,
|
|
||||||
* this can also be the full path of the file on the device.
|
|
||||||
* @param server URL of the server to receive the file, as encoded by encodeURI().
|
|
||||||
* @param successCallback A callback that is passed a FileUploadResult object.
|
|
||||||
* @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
|
|
||||||
* Invoked with a FileTransferError object.
|
|
||||||
* @param options Optional parameters.
|
|
||||||
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
|
|
||||||
* This is useful since Android rejects self-signed security certificates.
|
|
||||||
* Not recommended for production use. Supported on Android and iOS.
|
|
||||||
*/
|
|
||||||
upload(
|
|
||||||
fileURL: string,
|
|
||||||
server: string,
|
|
||||||
successCallback: (result: FileUploadResult) => void,
|
|
||||||
errorCallback: (error: FileTransferError) => void,
|
|
||||||
options?: FileUploadOptions,
|
|
||||||
trustAllHosts?: boolean): void;
|
|
||||||
/**
|
|
||||||
* downloads a file from server.
|
|
||||||
* @param source URL of the server to download the file, as encoded by encodeURI().
|
|
||||||
* @param target Filesystem url representing the file on the device. For backwards compatibility,
|
|
||||||
* this can also be the full path of the file on the device.
|
|
||||||
* @param successCallback A callback that is passed a FileEntry object. (Function)
|
|
||||||
* @param errorCallback A callback that executes if an error occurs when retrieving the fileEntry.
|
|
||||||
* Invoked with a FileTransferError object.
|
|
||||||
* @param options Optional parameters.
|
|
||||||
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
|
|
||||||
* This is useful since Android rejects self-signed security certificates.
|
|
||||||
* Not recommended for production use. Supported on Android and iOS.
|
|
||||||
*/
|
|
||||||
download(
|
|
||||||
source: string,
|
|
||||||
target: string,
|
|
||||||
successCallback: (fileEntry: FileEntry) => void,
|
|
||||||
errorCallback: (error: FileTransferError) => void,
|
|
||||||
options?: FileDownloadOptions,
|
|
||||||
trustAllHosts?: boolean): void;
|
|
||||||
/**
|
|
||||||
* Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object
|
|
||||||
* which has an error code of FileTransferError.ABORT_ERR.
|
|
||||||
*/
|
|
||||||
abort(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var FileTransfer: {
|
|
||||||
new (): FileTransfer;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** A FileUploadResult object is passed to the success callback of the FileTransfer object's upload() method. */
|
|
||||||
interface FileUploadResult {
|
|
||||||
/** The number of bytes sent to the server as part of the upload. */
|
|
||||||
bytesSent: number;
|
|
||||||
/** The HTTP response code returned by the server. */
|
|
||||||
responseCode: number;
|
|
||||||
/** The HTTP response returned by the server. */
|
|
||||||
response: string;
|
|
||||||
/** The HTTP response headers by the server. Currently supported on iOS only.*/
|
|
||||||
headers: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Optional parameters for upload method. */
|
|
||||||
interface FileUploadOptions {
|
|
||||||
/** The name of the form element. Defaults to file. */
|
|
||||||
fileKey?: string;
|
|
||||||
/** The file name to use when saving the file on the server. Defaults to image.jpg. */
|
|
||||||
fileName?: string;
|
|
||||||
/** The mime type of the data to upload. Defaults to image/jpeg. */
|
|
||||||
mimeType?: string;
|
|
||||||
/** A set of optional key/value pairs to pass in the HTTP request. */
|
|
||||||
params?: Object;
|
|
||||||
/** Whether to upload the data in chunked streaming mode. Defaults to true. */
|
|
||||||
chunkedMode?: boolean;
|
|
||||||
/** A map of header name/header values. Use an array to specify more than one value. */
|
|
||||||
headers?: Object[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Optional parameters for download method. */
|
|
||||||
interface FileDownloadOptions {
|
|
||||||
/** A map of header name/header values. Use an array to specify more than one value. */
|
|
||||||
headers?: Object[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A FileTransferError object is passed to an error callback when an error occurs. */
|
|
||||||
interface FileTransferError {
|
|
||||||
/**
|
|
||||||
* One of the predefined error codes listed below.
|
|
||||||
* FileTransferError.FILE_NOT_FOUND_ERR
|
|
||||||
* FileTransferError.INVALID_URL_ERR
|
|
||||||
* FileTransferError.CONNECTION_ERR
|
|
||||||
* FileTransferError.ABORT_ERR
|
|
||||||
*/
|
|
||||||
code: number;
|
|
||||||
/** URL to the source. */
|
|
||||||
source: string;
|
|
||||||
/** URL to the target. */
|
|
||||||
target: string;
|
|
||||||
/** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */
|
|
||||||
http_status: number;
|
|
||||||
/* Request body */
|
|
||||||
body: any;
|
|
||||||
/* Exception that is thrown by native code */
|
|
||||||
exception: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var FileTransferError: {
|
|
||||||
/** Constructor for FileTransferError object */
|
|
||||||
new (code?: number, source?: string, target?: string, status?: number, body?: any, exception?: any): FileTransferError;
|
|
||||||
FILE_NOT_FOUND_ERR: number;
|
|
||||||
INVALID_URL_ERR: number;
|
|
||||||
CONNECTION_ERR: number;
|
|
||||||
ABORT_ERR: number;
|
|
||||||
}
|
|
|
@ -1,255 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Globalization plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-globalization
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/** This plugin obtains information and performs operations specific to the user's locale and timezone. */
|
|
||||||
globalization: Globalization
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This plugin obtains information and performs operations specific to the user's locale and timezone. */
|
|
||||||
interface Globalization {
|
|
||||||
/**
|
|
||||||
* Get the string identifier for the client's current language.
|
|
||||||
* @param onSuccess Called on success getting the language with a properties object,
|
|
||||||
* that should have a value property with a String value.
|
|
||||||
* @param onError Called on error getting the language with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
|
|
||||||
*/
|
|
||||||
getPreferredLanguage(
|
|
||||||
onSuccess: (language: { value: string; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void): void;
|
|
||||||
/**
|
|
||||||
* Get the string identifier for the client's current locale setting.
|
|
||||||
* @param onSuccess Called on success getting the locale identifier with a properties object,
|
|
||||||
* that should have a value property with a String value.
|
|
||||||
* @param onError Called on error getting the locale identifier with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.UNKNOWN\_ERROR.
|
|
||||||
*/
|
|
||||||
getLocaleName(
|
|
||||||
onSuccess: (locale: { value: string; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void): void;
|
|
||||||
/**
|
|
||||||
* Returns a date formatted as a string according to the client's locale and timezone.
|
|
||||||
* @param date Date to format.
|
|
||||||
* @param onSuccess Called on success with a properties object,
|
|
||||||
* that should have a value property with a String value.
|
|
||||||
* @param onError Called on error with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
|
|
||||||
* @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'}
|
|
||||||
*/
|
|
||||||
dateToString(
|
|
||||||
date: Date,
|
|
||||||
onSuccess: (date: { value: string; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
options?: { type?: string; item?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Parses a date formatted as a string, according to the client's user preferences
|
|
||||||
* and calendar using the time zone of the client, and returns the corresponding date object.
|
|
||||||
* @param dateString String to parse
|
|
||||||
* @param onSuccess Called on success with GlobalizationDate object
|
|
||||||
* @param onError Called on error getting the language with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.PARSING_ERROR.
|
|
||||||
* @param options Optional parse parameters. Default {formatLength:'short', selector:'date and time'}
|
|
||||||
*/
|
|
||||||
stringToDate(
|
|
||||||
dateString: string,
|
|
||||||
onSuccess: (date: GlobalizationDate) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
options?: { type?: string; item?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Returns a pattern string to format and parse dates according to the client's user preferences.
|
|
||||||
* @param onSuccess Called on success getting pattern with a GlobalizationDatePattern object
|
|
||||||
* @param onError Called on error getting pattern with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.PATTERN_ERROR.
|
|
||||||
* @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'}
|
|
||||||
*/
|
|
||||||
getDatePattern(
|
|
||||||
onSuccess: (datePattern: GlobalizationDatePattern) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
options?: { type?: string; item?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
|
||||||
* @param onSuccess Called on success getting names with a properties object,
|
|
||||||
* that should have a value property with a String[] value.
|
|
||||||
* @param onError Called on error getting the language with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
|
|
||||||
* @param options Optional parameters. Default: {type:'wide', item:'months'}
|
|
||||||
*/
|
|
||||||
getDateNames(
|
|
||||||
onSuccess: (names: { value: string[]; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
options?: { type?: string; item?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
|
|
||||||
* @param {Date} date Date to check
|
|
||||||
* @param onSuccess Called on success with a properties object,
|
|
||||||
* that should have a dst property with a boolean value.
|
|
||||||
* @param onError Called on error with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
|
|
||||||
*/
|
|
||||||
isDaylightSavingsTime(
|
|
||||||
date: Date,
|
|
||||||
onSuccess: (result: { dst: boolean; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void): void;
|
|
||||||
/**
|
|
||||||
* Returns the first day of the week according to the client's user preferences and calendar.
|
|
||||||
* @param onSuccess Called on success with a day object,
|
|
||||||
* that should have a value property with a number value.
|
|
||||||
* @param onError Called on error with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
|
|
||||||
*/
|
|
||||||
getFirstDayOfWeek(
|
|
||||||
onSuccess: (day: { value: number; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void): void;
|
|
||||||
/**
|
|
||||||
* Returns a number formatted as a string according to the client's user preferences.
|
|
||||||
* @param value Number to format
|
|
||||||
* @param onSuccess Called on success with a result object,
|
|
||||||
* that should have a value property with a String value.
|
|
||||||
* @param onError Called on error with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
|
|
||||||
* @param format Optional format parameters. Default: {type:'decimal'}
|
|
||||||
*/
|
|
||||||
nubmerToString(
|
|
||||||
value: number,
|
|
||||||
onSuccess: (result: { value: string; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
format?: { type?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Parses a number formatted as a string according to the client's user preferences and returns the corresponding number.
|
|
||||||
* @param value String to parse
|
|
||||||
* @param onSuccess Called on success with a result object,
|
|
||||||
* that should have a value property with a number value.
|
|
||||||
* @param onError Called on error with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
|
|
||||||
* @param format Optional format parameters. Default: {type:'decimal'}
|
|
||||||
*/
|
|
||||||
stringToNumber(
|
|
||||||
value: string,
|
|
||||||
onSuccess: (result: { value: number; }) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
format?: { type?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Returns a pattern string to format and parse numbers according to the client's user preferences.
|
|
||||||
* @param onSuccess Called on success getting pattern with a GlobalizationNumberPattern object
|
|
||||||
* @param onError Called on error getting the language with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.PATTERN_ERROR.
|
|
||||||
* @param options Optional format parameters. Default {type:'decimal'}.
|
|
||||||
*/
|
|
||||||
getNumberPattern(
|
|
||||||
onSuccess: (result: GlobalizationNumberPattern) => void,
|
|
||||||
onError: (error: GlobalizationError) => void,
|
|
||||||
format?: { type?: string; }): void;
|
|
||||||
/**
|
|
||||||
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
|
|
||||||
* @param currencyCode Should be a String of one of the ISO 4217 currency codes, for example 'USD'.
|
|
||||||
* @param onSuccess Called on success getting pattern with a GlobalizatioCurrencyPattern object
|
|
||||||
* @param onError Called on error getting pattern with a GlobalizationError object.
|
|
||||||
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
|
|
||||||
* @param options Optional format parameters. Default {type:'decimal'}.
|
|
||||||
*/
|
|
||||||
getCurrencyPattern(
|
|
||||||
currencyCode: string,
|
|
||||||
onSuccess: (result: GlobalizationCurrencyPattern) => void,
|
|
||||||
onError: (error: GlobalizationError) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Date returned by stringToDate */
|
|
||||||
interface GlobalizationDate {
|
|
||||||
/* The four digit year. */
|
|
||||||
year: number;
|
|
||||||
/* The month from (0-11). */
|
|
||||||
month: number;
|
|
||||||
/* The day from (1-31). */
|
|
||||||
day: number;
|
|
||||||
/* The hour from (0-23). */
|
|
||||||
hour: number;
|
|
||||||
/* The minute from (0-59). */
|
|
||||||
minute: number;
|
|
||||||
/* The second from (0-59). */
|
|
||||||
second: number;
|
|
||||||
/* The milliseconds (from 0-999), not available on all platforms. */
|
|
||||||
millisecond: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Pattern to format and parse dates according to the client's user preferences.*/
|
|
||||||
interface GlobalizationDatePattern {
|
|
||||||
/* The date and time pattern to format and parse dates. The patterns follow Unicode Technical Standard #35. */
|
|
||||||
pattern: string;
|
|
||||||
/* The abbreviated name of the time zone on the client. */
|
|
||||||
timezone: string;
|
|
||||||
/* The current difference in seconds between the client's time zone and coordinated universal time. */
|
|
||||||
utc_offset: number;
|
|
||||||
/* The current daylight saving time offset in seconds between the client's non-daylight saving's time zone and the client's daylight saving's time zone. */
|
|
||||||
dst_offset: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GlobalizationDateNameOptions {
|
|
||||||
type?: string;
|
|
||||||
item?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Pattern to format and parse numbers according to the client's user preferences. */
|
|
||||||
interface GlobalizationNumberPattern {
|
|
||||||
/* The number pattern to format and parse numbers. The patterns follow Unicode Technical Standard #35. */
|
|
||||||
pattern: string;
|
|
||||||
/* The symbol to use when formatting and parsing, such as a percent or currency symbol. */
|
|
||||||
symbol: string;
|
|
||||||
/* The number of fractional digits to use when parsing and formatting numbers. */
|
|
||||||
fraction: number;
|
|
||||||
/* The rounding increment to use when parsing and formatting. */
|
|
||||||
rounding: number;
|
|
||||||
/* The symbol to use for positive numbers when parsing and formatting. */
|
|
||||||
positive: string;
|
|
||||||
/* The symbol to use for negative numbers when parsing and formatting. */
|
|
||||||
negative: string;
|
|
||||||
/* The decimal symbol to use for parsing and formatting. */
|
|
||||||
decimal: string;
|
|
||||||
/* The grouping symbol to use for parsing and formatting. */
|
|
||||||
grouping: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pattern to format and parse currency values according
|
|
||||||
* to the client's user preferences and ISO 4217 currency code.
|
|
||||||
*/
|
|
||||||
interface GlobalizationCurrencyPattern {
|
|
||||||
/** The currency pattern to format and parse currency values. The patterns follow Unicode Technical Standard #35. */
|
|
||||||
pattern: string;
|
|
||||||
/** The ISO 4217 currency code for the pattern. */
|
|
||||||
code: string;
|
|
||||||
/** The number of fractional digits to use when parsing and formatting currency. */
|
|
||||||
fraction: number;
|
|
||||||
/** The rounding increment to use when parsing and formatting. */
|
|
||||||
rounding: number;
|
|
||||||
/** The decimal symbol to use for parsing and formatting. */
|
|
||||||
decimal: string;
|
|
||||||
/** The grouping symbol to use for parsing and formatting. */
|
|
||||||
grouping: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** An object representing a error from the Globalization API. */
|
|
||||||
interface GlobalizationError {
|
|
||||||
/** One of the following codes representing the error type:
|
|
||||||
* GlobalizationError.UNKNOWN_ERROR: 0
|
|
||||||
* GlobalizationError.FORMATTING_ERROR: 1
|
|
||||||
* GlobalizationError.PARSING_ERROR: 2
|
|
||||||
* GlobalizationError.PATTERN_ERROR: 3
|
|
||||||
*/
|
|
||||||
code: number;
|
|
||||||
/** A text message that includes the error's explanation and/or details */
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** An object representing a error from the Globalization API. */
|
|
||||||
declare var GlobalizationError: {
|
|
||||||
UNKNOWN_ERROR: number;
|
|
||||||
FORMATTING_ERROR: number;
|
|
||||||
PARSING_ERROR: number;
|
|
||||||
PATTERN_ERROR: number;
|
|
||||||
}
|
|
|
@ -1,219 +0,0 @@
|
||||||
// Type definitions for Apache Cordova InAppBrowser plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-inappbrowser
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
/**
|
|
||||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
|
||||||
* @param url The URL to load.
|
|
||||||
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
|
|
||||||
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
|
||||||
* The options string must not contain any blank space, and each feature's
|
|
||||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
|
||||||
*/
|
|
||||||
open(url: string, target?: "_self", options?: string): InAppBrowser;
|
|
||||||
/**
|
|
||||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
|
||||||
* @param url The URL to load.
|
|
||||||
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
|
|
||||||
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
|
||||||
* The options string must not contain any blank space, and each feature's
|
|
||||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
|
||||||
*/
|
|
||||||
open(url: string, target?: "_blank", options?: string): InAppBrowser;
|
|
||||||
/**
|
|
||||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
|
||||||
* @param url The URL to load.
|
|
||||||
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
|
|
||||||
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
|
||||||
* The options string must not contain any blank space, and each feature's
|
|
||||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
|
||||||
*/
|
|
||||||
open(url: string, target?: "_system", options?: string): InAppBrowser;
|
|
||||||
/**
|
|
||||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
|
||||||
* @param url The URL to load.
|
|
||||||
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
|
|
||||||
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
|
||||||
* The options string must not contain any blank space, and each feature's
|
|
||||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
|
||||||
*/
|
|
||||||
open(url: string, target?: string, options?: string, replace?: boolean): InAppBrowser;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The object returned from a call to window.open.
|
|
||||||
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
|
|
||||||
*/
|
|
||||||
interface InAppBrowser extends Window {
|
|
||||||
onloadstart: (type: InAppBrowserEvent) => void;
|
|
||||||
onloadstop: (type: InAppBrowserEvent) => void;
|
|
||||||
onloaderror: (type: InAppBrowserEvent) => void;
|
|
||||||
onexit: (type: InAppBrowserEvent) => void;
|
|
||||||
// addEventListener overloads
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the InAppBrowser.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the InAppBrowser.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the InAppBrowser.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the InAppBrowser.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Adds a listener for an event from the InAppBrowser.
|
|
||||||
* @param type the event to listen for
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
addEventListener(type: string, callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
// removeEventListener overloads
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the InAppBrowser.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the InAppBrowser.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the InAppBrowser.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the InAppBrowser.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/**
|
|
||||||
* Removes a listener for an event from the InAppBrowser.
|
|
||||||
* @param type The event to stop listening for.
|
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void): void;
|
|
||||||
/** Closes the InAppBrowser window. */
|
|
||||||
close(): void;
|
|
||||||
/**
|
|
||||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
|
||||||
* if the InAppBrowser was already visible.
|
|
||||||
*/
|
|
||||||
show(): void;
|
|
||||||
/**
|
|
||||||
* Injects JavaScript code into the InAppBrowser window.
|
|
||||||
* @param script Details of the script to run, specifying either a file or code key.
|
|
||||||
* @param callback The function that executes after the JavaScript code is injected.
|
|
||||||
* If the injected script is of type code, the callback executes with
|
|
||||||
* a single parameter, which is the return value of the script, wrapped in an Array.
|
|
||||||
* For multi-line scripts, this is the return value of the last statement,
|
|
||||||
* or the last expression evaluated.
|
|
||||||
*/
|
|
||||||
executeScript(script: { code: string }, callback: (result: any) => void): void;
|
|
||||||
/**
|
|
||||||
* Injects JavaScript code into the InAppBrowser window.
|
|
||||||
* @param script Details of the script to run, specifying either a file or code key.
|
|
||||||
* @param callback The function that executes after the JavaScript code is injected.
|
|
||||||
* If the injected script is of type code, the callback executes with
|
|
||||||
* a single parameter, which is the return value of the script, wrapped in an Array.
|
|
||||||
* For multi-line scripts, this is the return value of the last statement,
|
|
||||||
* or the last expression evaluated.
|
|
||||||
*/
|
|
||||||
executeScript(script: { file: string }, callback: (result: any) => void): void;
|
|
||||||
/**
|
|
||||||
* Injects CSS into the InAppBrowser window.
|
|
||||||
* @param css Details of the script to run, specifying either a file or code key.
|
|
||||||
* @param callback The function that executes after the CSS is injected.
|
|
||||||
*/
|
|
||||||
insertCSS(css: { code: string }, callback: () => void): void;
|
|
||||||
/**
|
|
||||||
* Injects CSS into the InAppBrowser window.
|
|
||||||
* @param css Details of the script to run, specifying either a file or code key.
|
|
||||||
* @param callback The function that executes after the CSS is injected.
|
|
||||||
*/
|
|
||||||
insertCSS(css: { file: string }, callback: () => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface InAppBrowserEvent extends Event {
|
|
||||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
|
||||||
type: string;
|
|
||||||
/** the URL that was loaded. */
|
|
||||||
url: string;
|
|
||||||
/** the error code, only in the case of loaderror. */
|
|
||||||
code: number;
|
|
||||||
/** the error message, only in the case of loaderror. */
|
|
||||||
message: string;
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Media plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-media
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
declare var Media: {
|
|
||||||
new (
|
|
||||||
src: string,
|
|
||||||
mediaSuccess: () => void,
|
|
||||||
mediaError?: (error: MediaError) => any,
|
|
||||||
mediaStatus?: (status: number) => void): Media;
|
|
||||||
//Media statuses
|
|
||||||
MEDIA_NONE: number;
|
|
||||||
MEDIA_STARTING: number;
|
|
||||||
MEDIA_RUNNING: number;
|
|
||||||
MEDIA_PAUSED: number;
|
|
||||||
MEDIA_STOPPED: number
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This plugin provides the ability to record and play back audio files on a device.
|
|
||||||
* NOTE: The current implementation does not adhere to a W3C specification for media capture,
|
|
||||||
* and is provided for convenience only. A future implementation will adhere to the latest
|
|
||||||
* W3C specification and may deprecate the current APIs.
|
|
||||||
*/
|
|
||||||
interface Media {
|
|
||||||
/**
|
|
||||||
* Returns the current position within an audio file. Also updates the Media object's position parameter.
|
|
||||||
* @param mediaSuccess The callback that is passed the current position in seconds.
|
|
||||||
* @param mediaError The callback to execute if an error occurs.
|
|
||||||
*/
|
|
||||||
getCurrentPosition(
|
|
||||||
mediaSuccess: (position: number) => void,
|
|
||||||
mediaError?: (error: MediaError) => void): void;
|
|
||||||
/** Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. */
|
|
||||||
getDuration(): number;
|
|
||||||
/** Starts or resumes playing an audio file. */
|
|
||||||
play(): void;
|
|
||||||
/** Pauses playing an audio file. */
|
|
||||||
pause(): void;
|
|
||||||
/**
|
|
||||||
* Releases the underlying operating system's audio resources. This is particularly important
|
|
||||||
* for Android, since there are a finite amount of OpenCore instances for media playback.
|
|
||||||
* Applications should call the release function for any Media resource that is no longer needed.
|
|
||||||
*/
|
|
||||||
release(): void;
|
|
||||||
/**
|
|
||||||
* Sets the current position within an audio file.
|
|
||||||
* @param position Position in milliseconds.
|
|
||||||
*/
|
|
||||||
seekTo(position: number): void;
|
|
||||||
/**
|
|
||||||
* Set the volume for an audio file.
|
|
||||||
* @param volume The volume to set for playback. The value must be within the range of 0.0 to 1.0.
|
|
||||||
*/
|
|
||||||
setVolume(volume: number): void;
|
|
||||||
/** Starts recording an audio file. */
|
|
||||||
startRecord(): void;
|
|
||||||
/** Stops recording an audio file. */
|
|
||||||
stopRecord(): void;
|
|
||||||
/** Stops playing an audio file. */
|
|
||||||
stop(): void;
|
|
||||||
/**
|
|
||||||
* The position within the audio playback, in seconds.
|
|
||||||
* Not automatically updated during play; call getCurrentPosition to update.
|
|
||||||
*/
|
|
||||||
position: number;
|
|
||||||
/** The duration of the media, in seconds. */
|
|
||||||
duration: number;
|
|
||||||
}
|
|
|
@ -1,167 +0,0 @@
|
||||||
// Type definitions for Apache Cordova MediaCapture plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-media-capture
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
device: Device;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Device {
|
|
||||||
capture: Capture;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This plugin provides access to the device's audio, image, and video capture capabilities. */
|
|
||||||
interface Capture {
|
|
||||||
/**
|
|
||||||
* Start the audio recorder application and return information about captured audio clip files.
|
|
||||||
* @param onSuccess Executes when the capture operation finishes with an array
|
|
||||||
* of MediaFile objects describing each captured audio clip file.
|
|
||||||
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
|
|
||||||
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
|
|
||||||
* @param options Encapsulates audio capture configuration options.
|
|
||||||
*/
|
|
||||||
captureAudio(
|
|
||||||
onSuccess: (mediaFiles: MediaFile[]) => void,
|
|
||||||
onError: (error: CaptureError) => void,
|
|
||||||
options?: AudioOptions): void ;
|
|
||||||
/**
|
|
||||||
* Start the camera application and return information about captured image files.
|
|
||||||
* @param onSuccess Executes when the capture operation finishes with an array
|
|
||||||
* of MediaFile objects describing each captured image clip file.
|
|
||||||
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
|
|
||||||
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
|
|
||||||
* @param options Encapsulates audio capture configuration options.
|
|
||||||
*/
|
|
||||||
captureImage(
|
|
||||||
onSuccess: (mediaFiles: MediaFile[]) => void,
|
|
||||||
onError: (error: CaptureError) => void,
|
|
||||||
options?: ImageOptions): void ;
|
|
||||||
/**
|
|
||||||
* Start the video recorder application and return information about captured video clip files.
|
|
||||||
* @param onSuccess Executes when the capture operation finishes with an array
|
|
||||||
* of MediaFile objects describing each captured video clip file.
|
|
||||||
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
|
|
||||||
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
|
|
||||||
* @param options Encapsulates audio capture configuration options.
|
|
||||||
*/
|
|
||||||
captureVideo(
|
|
||||||
onSuccess: (mediaFiles: MediaFile[]) => void,
|
|
||||||
onError: (error: CaptureError) => void,
|
|
||||||
options?: VideoOptions): void ;
|
|
||||||
/** The audio recording formats supported by the device. */
|
|
||||||
supportedAudioModes: ConfigurationData[];
|
|
||||||
/** The recording image sizes and formats supported by the device. */
|
|
||||||
supportedImageModes: ConfigurationData[];
|
|
||||||
/** The recording video resolutions and formats supported by the device. */
|
|
||||||
supportedVideoModes: ConfigurationData[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates properties of a media capture file. */
|
|
||||||
interface MediaFile {
|
|
||||||
/** The name of the file, without path information. */
|
|
||||||
name: string;
|
|
||||||
/** The full path of the file, including the name. */
|
|
||||||
fullPath: string;
|
|
||||||
/** The file's mime type */
|
|
||||||
type: string;
|
|
||||||
/** The date and time when the file was last modified. */
|
|
||||||
lastModifiedDate: Date;
|
|
||||||
/** The size of the file, in bytes. */
|
|
||||||
size: number;
|
|
||||||
/**
|
|
||||||
* Retrieves format information about the media capture file.
|
|
||||||
* @param successCallback Invoked with a MediaFileData object when successful.
|
|
||||||
* @param errorCallback Invoked if the attempt fails, this function.
|
|
||||||
*/
|
|
||||||
getFormatData(
|
|
||||||
successCallback: (data: MediaFileData) => void,
|
|
||||||
errorCallback?: () => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates format information about a media file. */
|
|
||||||
interface MediaFileData {
|
|
||||||
/** The actual format of the audio and video content. */
|
|
||||||
codecs: string;
|
|
||||||
/** The average bitrate of the content. The value is zero for images. */
|
|
||||||
bitrate: number;
|
|
||||||
/** The height of the image or video in pixels. The value is zero for audio clips. */
|
|
||||||
height: number;
|
|
||||||
/** The width of the image or video in pixels. The value is zero for audio clips. */
|
|
||||||
width: number;
|
|
||||||
/** The length of the video or sound clip in seconds. The value is zero for images. */
|
|
||||||
duration: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates the error code resulting from a failed media capture operation. */
|
|
||||||
interface CaptureError {
|
|
||||||
/**
|
|
||||||
* One of the pre-defined error codes listed below.
|
|
||||||
* CaptureError.CAPTURE_INTERNAL_ERR
|
|
||||||
* The camera or microphone failed to capture image or sound.
|
|
||||||
* CaptureError.CAPTURE_APPLICATION_BUSY
|
|
||||||
* The camera or audio capture application is currently serving another capture request.
|
|
||||||
* CaptureError.CAPTURE_INVALID_ARGUMENT
|
|
||||||
* Invalid use of the API (e.g., the value of limit is less than one).
|
|
||||||
* CaptureError.CAPTURE_NO_MEDIA_FILES
|
|
||||||
* The user exits the camera or audio capture application before capturing anything.
|
|
||||||
* CaptureError.CAPTURE_NOT_SUPPORTED
|
|
||||||
* The requested capture operation is not supported.
|
|
||||||
*/
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var CaptureError: {
|
|
||||||
/** Constructor for CaptureError */
|
|
||||||
new (code: number, message: string): CaptureError;
|
|
||||||
CAPTURE_INTERNAL_ERR: number;
|
|
||||||
CAPTURE_APPLICATION_BUSY: number;
|
|
||||||
CAPTURE_INVALID_ARGUMENT: number;
|
|
||||||
CAPTURE_NO_MEDIA_FILES: number;
|
|
||||||
CAPTURE_NOT_SUPPORTED: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates audio capture configuration options. */
|
|
||||||
interface AudioOptions {
|
|
||||||
/**
|
|
||||||
* The maximum number of audio clips the device's user can capture in a single
|
|
||||||
* capture operation. The value must be greater than or equal to 1.
|
|
||||||
*/
|
|
||||||
limit?: number;
|
|
||||||
/** The maximum duration of a audio clip, in seconds. */
|
|
||||||
duration?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates image capture configuration options. */
|
|
||||||
interface ImageOptions {
|
|
||||||
/**
|
|
||||||
* The maximum number of images the user can capture in a single capture operation.
|
|
||||||
* The value must be greater than or equal to 1 (defaults to 1).
|
|
||||||
*/
|
|
||||||
limit?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates video capture configuration options. */
|
|
||||||
interface VideoOptions {
|
|
||||||
/**
|
|
||||||
* The maximum number of video clips the device's user can capture in a single
|
|
||||||
* capture operation. The value must be greater than or equal to 1.
|
|
||||||
*/
|
|
||||||
limit?: number;
|
|
||||||
/** The maximum duration of a video clip, in seconds. */
|
|
||||||
duration?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Encapsulates a set of media capture parameters that a device supports. */
|
|
||||||
interface ConfigurationData {
|
|
||||||
/** The ASCII-encoded lowercase string representing the media type. */
|
|
||||||
type: string;
|
|
||||||
/** The height of the image or video in pixels. The value is zero for sound clips. */
|
|
||||||
height: number;
|
|
||||||
/** The width of the image or video in pixels. The value is zero for sound clips. */
|
|
||||||
width: number;
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Network Information plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-network-information
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/**
|
|
||||||
* This plugin provides an implementation of an old version of the Network Information API.
|
|
||||||
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
|
|
||||||
*/
|
|
||||||
connection: Connection;
|
|
||||||
// see https://github.com/apache/cordova-plugin-network-information/blob/dev/doc/index.md#api-change
|
|
||||||
// for
|
|
||||||
network: {
|
|
||||||
/**
|
|
||||||
* This plugin provides an implementation of an old version of the Network Information API.
|
|
||||||
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
|
|
||||||
*/
|
|
||||||
connection: Connection
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Document {
|
|
||||||
addEventListener(type: "online", connectionStateCallback: () => any, useCapture?: boolean): void;
|
|
||||||
addEventListener(type: "offline", connectionStateCallback: () => any, useCapture?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The connection object, exposed via navigator.connection, provides information
|
|
||||||
* about the device's cellular and wifi connection.
|
|
||||||
*/
|
|
||||||
interface Connection {
|
|
||||||
/**
|
|
||||||
* This property offers a fast way to determine the device's network connection state, and type of connection.
|
|
||||||
* One of:
|
|
||||||
* Connection.UNKNOWN
|
|
||||||
* Connection.ETHERNET
|
|
||||||
* Connection.WIFI
|
|
||||||
* Connection.CELL_2G
|
|
||||||
* Connection.CELL_3G
|
|
||||||
* Connection.CELL_4G
|
|
||||||
* Connection.CELL
|
|
||||||
* Connection.NONE
|
|
||||||
*/
|
|
||||||
type: number
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Connection: {
|
|
||||||
UNKNOWN: number;
|
|
||||||
ETHERNET: number;
|
|
||||||
WIFI: number;
|
|
||||||
CELL_2G: number;
|
|
||||||
CELL_3G: number;
|
|
||||||
CELL_4G: number;
|
|
||||||
CELL: number;
|
|
||||||
NONE: number;
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Push plugin.
|
|
||||||
// Project: https://github.com/phonegap-build/PushPlugin
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
plugins: Plugins
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Plugins {
|
|
||||||
/**
|
|
||||||
* This plugin allows to receive push notifications. The Android implementation uses
|
|
||||||
* Google's GCM (Google Cloud Messaging) service,
|
|
||||||
* whereas the iOS version is based on Apple APNS Notifications
|
|
||||||
*/
|
|
||||||
pushNotification: PushNotification
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This plugin allows to receive push notifications. The Android implementation uses
|
|
||||||
* Google's GCM (Google Cloud Messaging) service,
|
|
||||||
* whereas the iOS version is based on Apple APNS Notifications
|
|
||||||
*/
|
|
||||||
interface PushNotification {
|
|
||||||
/**
|
|
||||||
* Registers as push notification receiver.
|
|
||||||
* @param successCallback Called when a plugin method returns without error.
|
|
||||||
* @param errorCallback Called when the plugin returns an error.
|
|
||||||
* @param registrationOptions Options for registration process.
|
|
||||||
*/
|
|
||||||
register(
|
|
||||||
successCallback: (registrationId: string) => void,
|
|
||||||
errorCallback: (error: any) => void,
|
|
||||||
registrationOptions: RegistrationOptions): void;
|
|
||||||
/**
|
|
||||||
* Unregisters as push notification receiver.
|
|
||||||
* @param successCallback Called when a plugin method returns without error.
|
|
||||||
* @param errorCallback Called when the plugin returns an error.
|
|
||||||
*/
|
|
||||||
unregister(
|
|
||||||
successCallback: (result: any) => void,
|
|
||||||
errorCallback: (error: any) => void): void;
|
|
||||||
/**
|
|
||||||
* Sets the badge count visible when the app is not running. iOS only.
|
|
||||||
* @param successCallback Called when a plugin method returns without error.
|
|
||||||
* @param errorCallback Called when the plugin returns an error.
|
|
||||||
* @param badgeCount An integer indicating what number should show up in the badge. Passing 0 will clear the badge.
|
|
||||||
*/
|
|
||||||
setApplicationIconBadgeNumber(
|
|
||||||
successCallback: (result: any) => void,
|
|
||||||
errorCallback: (error: any) => void,
|
|
||||||
badgeCount: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Options for registration process. */
|
|
||||||
interface RegistrationOptions {
|
|
||||||
/** This is the Google project ID you need to obtain by registering your application for GCM. Android only */
|
|
||||||
senderID?: string;
|
|
||||||
/** WP8 only */
|
|
||||||
channelName?: string;
|
|
||||||
/** Callback, that is fired when notification arrived */
|
|
||||||
ecb?: string;
|
|
||||||
badge?: boolean;
|
|
||||||
sound?: boolean;
|
|
||||||
alert?: boolean
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Splashscreen plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-splashscreen
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
/** This plugin displays and hides a splash screen during application launch. */
|
|
||||||
splashscreen: {
|
|
||||||
/** Dismiss the splash screen. */
|
|
||||||
hide(): void;
|
|
||||||
/** Displays the splash screen. */
|
|
||||||
show(): void;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Type definitions for Apache Cordova Vibration plugin.
|
|
||||||
// Project: https://github.com/apache/cordova-plugin-vibration
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Notification {
|
|
||||||
/**
|
|
||||||
* Vibrates the device for the specified amount of time.
|
|
||||||
* @param time Milliseconds to vibrate the device. Ignored on iOS.
|
|
||||||
*/
|
|
||||||
vibrate(time: number): void
|
|
||||||
/**
|
|
||||||
* Vibrates the device with a given pattern.
|
|
||||||
* @param number[] pattern Pattern with which to vibrate the device.
|
|
||||||
* The first value - number of milliseconds to wait before turning the vibrator on.
|
|
||||||
* The next value - the number of milliseconds for which to keep the vibrator on before turning it off.
|
|
||||||
* @param number repeat Optional index into the pattern array at which to start repeating (will repeat until canceled),
|
|
||||||
* or -1 for no repetition (default).
|
|
||||||
*/
|
|
||||||
vibrateWithPattern(pattern: number[], repeat: number): void;
|
|
||||||
/**
|
|
||||||
* Immediately cancels any currently running vibration.
|
|
||||||
*/
|
|
||||||
cancelVibration(): void;
|
|
||||||
}
|
|
|
@ -1,103 +0,0 @@
|
||||||
// Type definitions for Apache Cordova WebSQL plugin.
|
|
||||||
// Project: https://github.com/MSOpenTech/cordova-plugin-websql
|
|
||||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
/**
|
|
||||||
* Creates (opens, if exist) database with supplied parameters.
|
|
||||||
* @param name Database name
|
|
||||||
* @param version Database version
|
|
||||||
* @param displayname Database display name
|
|
||||||
* @param size Size, in bytes
|
|
||||||
* @param creationCallback Callback, that executed on database creation. Accepts Database object.
|
|
||||||
*/
|
|
||||||
openDatabase(name: string,
|
|
||||||
version: string,
|
|
||||||
displayname: string,
|
|
||||||
size: number,
|
|
||||||
creationCallback?: (database: Database) => void): Database;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Database {
|
|
||||||
/**
|
|
||||||
* Starts new transaction.
|
|
||||||
* @param callback Function, that will be called when transaction starts.
|
|
||||||
* @param errorCallback Called, when Transaction fails.
|
|
||||||
* @param successCallback Called, when transaction committed.
|
|
||||||
*/
|
|
||||||
transaction(callback: (transaction: SqlTransaction) => void,
|
|
||||||
errorCallback?: (error: SqlError) => void,
|
|
||||||
successCallback?: () => void): void;
|
|
||||||
/**
|
|
||||||
* Starts new transaction.
|
|
||||||
* @param callback Function, that will be called when transaction starts.
|
|
||||||
* @param errorCallback Called, when Transaction fails.
|
|
||||||
* @param successCallback Called, when transaction committed.
|
|
||||||
*/
|
|
||||||
readTransaction(callback: (transaction: SqlTransaction) => void,
|
|
||||||
errorCallback?: (error: SqlError) => void,
|
|
||||||
successCallback?: () => void): void;
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
displayName: string;
|
|
||||||
size: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Database: {
|
|
||||||
/** Constructor for Database object */
|
|
||||||
new(name: string,
|
|
||||||
version: string,
|
|
||||||
displayname: string,
|
|
||||||
size: number,
|
|
||||||
creationCallback: (database: Database)=> void): Database;
|
|
||||||
};
|
|
||||||
|
|
||||||
interface SqlTransaction {
|
|
||||||
/**
|
|
||||||
* Executes SQL statement via current transaction.
|
|
||||||
* @param sql SQL statement to execute.
|
|
||||||
* @param arguments SQL stetement arguments.
|
|
||||||
* @param successCallback Called in case of query has been successfully done.
|
|
||||||
* @param errorCallback Called, when query fails.
|
|
||||||
*/
|
|
||||||
executeSql(sql: string,
|
|
||||||
arguments?: any[],
|
|
||||||
successCallback?: (transaction: SqlTransaction, resultSet: SqlResultSet) => void,
|
|
||||||
errorCallback?: (transaction: SqlTransaction, error: SqlError) => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var SqlTransaction: {
|
|
||||||
new(): SqlTransaction;
|
|
||||||
};
|
|
||||||
|
|
||||||
interface SqlResultSet {
|
|
||||||
insertId: number;
|
|
||||||
rowsAffected: number;
|
|
||||||
rows: SqlResultSetRowList;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SqlResultSetRowList {
|
|
||||||
length: number;
|
|
||||||
item(index: number): Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SqlError {
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var SqlError: {
|
|
||||||
// Error code constants from http://www.w3.org/TR/webdatabase/#sqlerror
|
|
||||||
UNKNOWN_ERR: number;
|
|
||||||
DATABASE_ERR: number;
|
|
||||||
VERSION_ERR: number;
|
|
||||||
TOO_LARGE_ERR: number;
|
|
||||||
QUOTA_ERR: number;
|
|
||||||
SYNTAX_ERR: number;
|
|
||||||
CONSTRAINT_ERR: number;
|
|
||||||
TIMEOUT_ERR: number;
|
|
||||||
};
|
|
|
@ -1,21 +0,0 @@
|
||||||
/********************************************************
|
|
||||||
* *
|
|
||||||
* Copyright (C) Microsoft. All rights reserved. *
|
|
||||||
* *
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
// Note: cordova.d.ts defines typings for cordova as a cordova app would see it.
|
|
||||||
// This file defines typings as the npm cordova module is used
|
|
||||||
|
|
||||||
declare module "taco-lib" {
|
|
||||||
|
|
||||||
import Q = require('q');
|
|
||||||
|
|
||||||
export function create(dir: string, id: string, name: string, cfg: string): Q.Promise<any>;
|
|
||||||
export function build(options?: any): Q.Promise<any>;
|
|
||||||
export function compile(options?: any): Q.Promise<any>;
|
|
||||||
export function prepare(options?: any): Q.Promise<any>;
|
|
||||||
export function platform(command: string, targets?: string, options?: any): Q.IPromise<any>;
|
|
||||||
export function run(options?: any): Q.Promise<any>;
|
|
||||||
export function emulate(options?: any): Q.Promise<any>;
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"name": "taco-cli-utility",
|
|
||||||
"author": {
|
|
||||||
"name": "Microsoft Corp."
|
|
||||||
},
|
|
||||||
"description": "strictly internal use to enable require in utility folder",
|
|
||||||
"homepage": "",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://xxxxxxxxxxgithub.com/Microsoft/taco-cli.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"Cordova",
|
|
||||||
"Microsoft",
|
|
||||||
"taco",
|
|
||||||
"Apache",
|
|
||||||
"cross-platform"
|
|
||||||
],
|
|
||||||
|
|
||||||
"dependencies" : {
|
|
||||||
"typescript": ">=1.4.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
}
|
|
||||||
}
|
|
Загрузка…
Ссылка в новой задаче