mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
cordova plugins: Provide their own types (#22305)
This commit is contained in:
@@ -234,6 +234,114 @@
|
||||
"sourceRepoURL": "https://github.com/jayphelps/core-decorators.js",
|
||||
"asOfVersion": "0.20.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-battery-status",
|
||||
"typingsPackageName": "cordova-plugin-battery-status",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-battery-status",
|
||||
"asOfVersion": "1.2.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-camera",
|
||||
"typingsPackageName": "cordova-plugin-camera",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-camera",
|
||||
"asOfVersion": "2.4.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-contacts",
|
||||
"typingsPackageName": "cordova-plugin-contacts",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-contacts",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-device",
|
||||
"typingsPackageName": "cordova-plugin-device",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-device",
|
||||
"asOfVersion": "1.1.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-device-motion",
|
||||
"typingsPackageName": "cordova-plugin-device-motion",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-device-motion",
|
||||
"asOfVersion": "1.2.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "Apache Cordova Device Orientation plugin",
|
||||
"typingsPackageName": "cordova-plugin-device-orientation",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-device-orientation",
|
||||
"asOfVersion": "1.0.6"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-dialogs",
|
||||
"typingsPackageName": "cordova-plugin-dialogs",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-dialogs",
|
||||
"asOfVersion": "1.3.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "Apache Cordova File System plugin",
|
||||
"typingsPackageName": "cordova-plugin-file",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-file",
|
||||
"asOfVersion": "4.3.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-file-transfer",
|
||||
"typingsPackageName": "cordova-plugin-file-transfer",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-file-transfer",
|
||||
"asOfVersion": "1.6.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-globalization",
|
||||
"typingsPackageName": "cordova-plugin-globalization",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-globalization",
|
||||
"asOfVersion": "1.0.6"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-inappbrowser",
|
||||
"typingsPackageName": "cordova-plugin-inappbrowser",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-inappbrowser",
|
||||
"asOfVersion": "1.7.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-media",
|
||||
"typingsPackageName": "cordova-plugin-media",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-media",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-media-capture",
|
||||
"typingsPackageName": "cordova-plugin-media-capture",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-media-capture",
|
||||
"asOfVersion": "1.4.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-network-information",
|
||||
"typingsPackageName": "cordova-plugin-network-information",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-network-information",
|
||||
"asOfVersion": "1.3.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-splashscreen",
|
||||
"typingsPackageName": "cordova-plugin-splashscreen",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-splashscreen",
|
||||
"asOfVersion": "4.0.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "Apache Cordova StatusBar plugin",
|
||||
"typingsPackageName": "cordova-plugin-statusbar",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-statusbar",
|
||||
"asOfVersion": "2.2.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "Apache Cordova Vibration plugin",
|
||||
"typingsPackageName": "cordova-plugin-vibration",
|
||||
"sourceRepoURL": "https://github.com/apache/cordova-plugin-vibration",
|
||||
"asOfVersion": "2.1.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova.plugins.diagnostic",
|
||||
"typingsPackageName": "cordova.plugins.diagnostic",
|
||||
"sourceRepoURL": "https://github.com/dpa99c/cordova-diagnostic-plugin",
|
||||
"asOfVersion": "3.7.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cypress",
|
||||
"typingsPackageName": "cypress",
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
function eventCallBack(ev: BatteryStatusEvent) {
|
||||
console.log('Battery level is ' + ev.level);
|
||||
}
|
||||
window.addEventListener('batterystatus', (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); });
|
||||
window.addEventListener('batterystatus', (ev) => { console.log('Battery level is ' + ev.level); });
|
||||
window.addEventListener('batterycritical', (ev) => { console.log('Battery is critical: ' + ev.level); });
|
||||
window.addEventListener('batterylow', (ev) => { console.log('Battery is low: ' + ev.level); });
|
||||
|
||||
window.addEventListener('baterystatus', eventCallBack);
|
||||
window.addEventListener('batterycritical', eventCallBack);
|
||||
window.addEventListener('batterylow', eventCallBack);
|
||||
|
||||
window.removeEventListener('batterystatus', eventCallBack);
|
||||
window.removeEventListener('batterycritical', eventCallBack);
|
||||
window.removeEventListener('batterylow', eventCallBack);
|
||||
|
||||
window.addEventListener('batterycritical', () => { alert('Battery is critical low!'); });
|
||||
window.addEventListener('batterylow', () => { alert('Battery is low!'); });
|
||||
|
||||
function batteryCriticalCallback() {
|
||||
alert('Battery is critical low!');
|
||||
}
|
||||
|
||||
function batteryLowCallback() {
|
||||
alert('Battery is critical low!');
|
||||
}
|
||||
|
||||
window.addEventListener('batterycritical', batteryCriticalCallback);
|
||||
window.addEventListener('batterylow', batteryLowCallback);
|
||||
-37
@@ -1,37 +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/DefinitelyTyped/DefinitelyTyped
|
||||
//
|
||||
// Copyright (c) Microsoft Open Technologies Inc
|
||||
// Licensed under the MIT license.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface WindowEventMap {
|
||||
/**
|
||||
* batterystatus: event fires when the percentage of battery charge changes by at least 1 percent, or if the device is plugged in or unplugged.
|
||||
*/
|
||||
"batterystatus" : BatteryStatusEvent;
|
||||
/**
|
||||
* batterycritical: event fires when the percentage of battery charge has reached the critical battery threshold. The value is device-specific.
|
||||
*/
|
||||
"batterycritical": BatteryStatusEvent;
|
||||
/**
|
||||
* batterylow: event fires when the percentage of battery charge has reached the low battery threshold, device-specific value.
|
||||
*/
|
||||
"batterylow": BatteryStatusEvent;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
onbatterystatus: (type: BatteryStatusEvent) => void;
|
||||
onbatterycritical: (type: BatteryStatusEvent) => void;
|
||||
onbatterylow: (type: BatteryStatusEvent) => 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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-battery-status-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
navigator.camera.getPicture(
|
||||
(data: string) => { alert('Got photo!'); },
|
||||
(message: string)=> { alert('Failed!: ' + message); },
|
||||
{
|
||||
allowEdit: true,
|
||||
cameraDirection: Camera.Direction.BACK,
|
||||
destinationType: Camera.DestinationType.FILE_URI,
|
||||
encodingType: Camera.EncodingType.JPEG,
|
||||
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
|
||||
quality: 80
|
||||
});
|
||||
-174
@@ -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/DefinitelyTyped/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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-camera-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
var contact: Contact = navigator.contacts.create({
|
||||
nickname: 'John Smith',
|
||||
displayName: 'John Smith',
|
||||
phoneNumbers: [{ pref: true, type: "work", value: "+185642556856" }]
|
||||
});
|
||||
|
||||
navigator.contacts.find(["phoneNumbers"],
|
||||
(contacts: Contact[])=> { alert('Find ' + contacts.length + ' contacts'); },
|
||||
(error: ContactError) => { alert('Error: ' + error.message); },
|
||||
new ContactFindOptions("+1", true)
|
||||
);
|
||||
|
||||
navigator.contacts.pickContact(
|
||||
(contact: Contact)=> { console.log(contact); },
|
||||
(err: ContactError)=> { console.log(err.message); }
|
||||
);
|
||||
-337
@@ -1,337 +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/DefinitelyTyped/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
|
||||
|
||||
/**
|
||||
* This allows us to use an enumeration when setting the desired fields for the ContactFindOptions.
|
||||
* The values will correspond to the type of string literals in ContactFieldType.
|
||||
*/
|
||||
fieldType: {
|
||||
addresses: "addresses",
|
||||
birthday: "birthday",
|
||||
categories: "categories",
|
||||
country: "country",
|
||||
department: "department",
|
||||
displayName: "displayName",
|
||||
emails: "emails",
|
||||
familyName: "familyName",
|
||||
formatted: "formatted",
|
||||
givenName: "givenName",
|
||||
honorificPrefix: "honorificPrefix",
|
||||
honorificSuffix: "honorificSuffix",
|
||||
id: "id",
|
||||
ims: "ims",
|
||||
locality: "locality",
|
||||
middleName: "middleName",
|
||||
name: "name",
|
||||
nickname: "nickname",
|
||||
note: "note",
|
||||
organizations: "organizations",
|
||||
phoneNumbers: "phoneNumbers",
|
||||
photos: "photos",
|
||||
postalCode: "postalCode",
|
||||
region: "region",
|
||||
streetAddress: "streetAddress",
|
||||
title: "title",
|
||||
urls: "urls"
|
||||
}
|
||||
}
|
||||
|
||||
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?: ContactFieldType[];
|
||||
}
|
||||
|
||||
/** these are the string values that are valid for the desired fields in ContactFindOptions */
|
||||
declare type ContactFieldType =
|
||||
"addresses"
|
||||
| "birthday"
|
||||
| "categories"
|
||||
| "country"
|
||||
| "department"
|
||||
| "displayName"
|
||||
| "emails"
|
||||
| "familyName"
|
||||
| "formatted"
|
||||
| "givenName"
|
||||
| "honorificPrefix"
|
||||
| "honorificSuffix"
|
||||
| "id"
|
||||
| "ims"
|
||||
| "locality"
|
||||
| "middleName"
|
||||
| "name"
|
||||
| "nickname"
|
||||
| "note"
|
||||
| "organizations"
|
||||
| "phoneNumbers"
|
||||
| "photos"
|
||||
| "postalCode"
|
||||
| "region"
|
||||
| "streetAddress"
|
||||
| "title"
|
||||
| "urls";
|
||||
|
||||
declare var ContactFindOptions: {
|
||||
/** Constructor for ContactFindOptions object */
|
||||
new (filter?: string,
|
||||
multiple?: boolean,
|
||||
desiredFields?: ContactFieldType[]): ContactFindOptions
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-contacts-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
navigator.accelerometer.getCurrentAcceleration(
|
||||
(acc: Acceleration) => { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
|
||||
() => { alert('Error!'); });
|
||||
|
||||
var acchandle: WatchHandle = navigator.accelerometer.watchAcceleration(
|
||||
(acc: Acceleration)=> { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
|
||||
() => { alert('Error!'); },
|
||||
{ frequency: 10 });
|
||||
|
||||
navigator.accelerometer.clearWatch(acchandle);
|
||||
-77
@@ -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/DefinitelyTyped/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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-device-motion-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
navigator.compass.getCurrentHeading(
|
||||
(heading: CompassHeading)=> { console.log('Got heading to ' + heading.magneticHeading); },
|
||||
(error: CompassError)=> { alert('Error! ' + error.code); },
|
||||
{ frequency: 10 });
|
||||
|
||||
var accelhandle = navigator.compass.watchHeading(
|
||||
(heading: CompassHeading) => { console.log('Got heading to ' + heading.magneticHeading); },
|
||||
(error: CompassError) => { alert('Error! ' + error.code); },
|
||||
{ frequency: 10 });
|
||||
|
||||
navigator.compass.clearWatch(accelhandle);
|
||||
@@ -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/DefinitelyTyped/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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-device-orientation-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
console.log(JSON.stringify(device));
|
||||
-41
@@ -1,41 +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/DefinitelyTyped/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;
|
||||
/** Indicates that Cordova initialize successfully. */
|
||||
available: boolean;
|
||||
/**
|
||||
* 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;
|
||||
/** 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;
|
||||
/** Get the device's manufacturer. */
|
||||
manufacturer: string;
|
||||
/** Whether the device is running on a simulator. */
|
||||
isVirtual: boolean;
|
||||
/** Get the device hardware serial number. */
|
||||
serial: string;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
device: Device;
|
||||
}
|
||||
|
||||
declare var device: Device;
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-device-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
navigator.notification.alert('Alert!', () => { alert('You\'re alerted'); }, 'Alert', 'Ok');
|
||||
navigator.notification.confirm('Are you ok?', (choice: number) => { alert('Your choice is ' + choice); });
|
||||
-69
@@ -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/DefinitelyTyped/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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-dialogs-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
var file = new FileTransfer();
|
||||
|
||||
file.onprogress = (ev: ProgressEvent) => {
|
||||
if (ev.lengthComputable) {
|
||||
console.log(ev.loaded + '/' + ev.total);
|
||||
}
|
||||
};
|
||||
|
||||
file.download('http://some.server.com/download.php',
|
||||
'cdvfile://localhost/persistent/path/to/downloads/',
|
||||
(file: FileEntry)=> { console.log('File Downloaded to ' + file.fullPath); },
|
||||
(err: FileTransferError) => {
|
||||
console.error('Error ' + err.code);
|
||||
if (err.exception) {
|
||||
console.error('Failed with exception ' + err.exception);
|
||||
}
|
||||
},
|
||||
true,
|
||||
{
|
||||
headers: {
|
||||
"Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
|
||||
}
|
||||
});
|
||||
|
||||
file.upload('cdvfile://localhost/persistent/path/to/downloads/',
|
||||
'http://some.server.com/download.php',
|
||||
(result: FileUploadResult)=> { console.log('File uploaded. Bytes uploaded: ' + result.bytesSent); },
|
||||
(err: FileTransferError) => {
|
||||
console.error('Error ' + err.code);
|
||||
if (err.exception) {
|
||||
console.error('Failed with exception ' + err.exception);
|
||||
}
|
||||
},
|
||||
{ headers: {"X-Email": "user@mail.com", 'X-Token': "asdf3w234"}, httpMethod: "PUT" },
|
||||
true);
|
||||
|
||||
file.abort();
|
||||
-136
@@ -1,136 +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/DefinitelyTyped/DefinitelyTyped
|
||||
//
|
||||
// Copyright (c) Microsoft Open Technologies Inc
|
||||
// Licensed under the MIT license
|
||||
|
||||
/// <reference types="cordova-plugin-file" />
|
||||
|
||||
/**
|
||||
* 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,
|
||||
trustAllHosts?: boolean,
|
||||
options?: FileDownloadOptions): 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 HTTP method to use - either `PUT` or `POST`. Defaults to `POST`. */
|
||||
httpMethod?: 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. */
|
||||
headers?: {};
|
||||
}
|
||||
|
||||
/** 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
|
||||
* FileTransferError.NOT_MODIFIED_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;
|
||||
/* Response body. This attribute is only available when a response is received from the HTTP connection. */
|
||||
body: string;
|
||||
/* 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;
|
||||
NOT_MODIFIED_ERR: number;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-file-transfer-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/// <reference types="cordova"/>
|
||||
|
||||
function fsaccessor(fs: FileSystem) {
|
||||
console.log('FS root is: ' + fs.root.name);
|
||||
var fsreader: DirectoryReader = fs.root.createReader();
|
||||
fsreader.readEntries(
|
||||
(entries: Entry[]) => { console.log(fs.root.name + ' has ' + entries.length + ' child elements'); },
|
||||
(err: FileError)=> { alert('Error: ' + err.code); });
|
||||
}
|
||||
|
||||
window.requestFileSystem(
|
||||
LocalFileSystem.TEMPORARY,
|
||||
1024 * 1024 * 5,
|
||||
fsaccessor,
|
||||
(err: FileError) => { alert('Error: ' + err.code); }
|
||||
);
|
||||
|
||||
window.requestFileSystem(
|
||||
LocalFileSystem.PERSISTENT,
|
||||
1024 * 1024 * 5,
|
||||
fsaccessor,
|
||||
(err: FileError) => { alert('Error: ' + err.code); }
|
||||
);
|
||||
|
||||
window.resolveLocalFileSystemURI(cordova.file.applicationDirectory,
|
||||
(entry: Entry)=> {
|
||||
if (entry.isDirectory) {
|
||||
console.log('successfully resolved ' + entry.fullPath + 'directory');
|
||||
console.log(entry.toURL());
|
||||
console.log(entry.toInternalURL());
|
||||
} else {
|
||||
var fentry = <FileEntry>entry;
|
||||
fentry.file((f: File) => { console.log(f.slice(f.size - 10, f.size)); });
|
||||
fentry.createWriter((writer: FileWriter)=> {
|
||||
if (writer.readyState == FileWriter.INIT) {
|
||||
console.log('Init FileWriter');
|
||||
writer.write(new Blob(['sdfdsfsdf']));
|
||||
writer.onprogress = function(ev: ProgressEvent) {
|
||||
console.log('Writing ' + ev.target);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
(error: FileError) => { console.log(error.code); }
|
||||
);
|
||||
Vendored
-378
@@ -1,378 +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/DefinitelyTyped/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: LocalFileSystem,
|
||||
size: number,
|
||||
successCallback: (fileSystem: FileSystem) => void,
|
||||
errorCallback?: (fileError: FileError) => void): void;
|
||||
/**
|
||||
* Look up file system Entry referred to by local URL.
|
||||
* @param string url URL referring to a local file or directory
|
||||
* @param successCallback invoked with Entry object corresponding to URL
|
||||
* @param errorCallback invoked if error occurs retrieving file system entry
|
||||
*/
|
||||
resolveLocalFileSystemURL(url: string,
|
||||
successCallback: (entry: Entry) => void,
|
||||
errorCallback?: (error: 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare enum LocalFileSystem {
|
||||
PERSISTENT=0,
|
||||
TEMPORARY=1
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-file-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
navigator.globalization.dateToString(new Date(),
|
||||
(date) => { console.log(JSON.stringify(date)); },
|
||||
(error) => { alert(error.message); },
|
||||
{ formatLength: "short", selector: "date" });
|
||||
|
||||
navigator.globalization.getDateNames(
|
||||
(names) => {
|
||||
names.value.forEach((name) => { console.log(name); });
|
||||
},
|
||||
(error) => { alert(error.message); },
|
||||
{ item: "months", type: "wide" });
|
||||
-260
@@ -1,260 +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/DefinitelyTyped/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'}
|
||||
* - 'formatLength' can be "short", "medium", "long", or "full".
|
||||
* - 'selector' can be "date", "time", or "date and time".
|
||||
*/
|
||||
dateToString(
|
||||
date: Date,
|
||||
onSuccess: (date: { value: string; }) => void,
|
||||
onError: (error: GlobalizationError) => void,
|
||||
options?: {
|
||||
formatLength?: string; // "short" | "medium" | "long" | "full"
|
||||
selector?: string; // "date" | "time" | "date and time"
|
||||
}): 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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-globalization-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// InAppBrowser plugin
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// signature of window.open() added by InAppBrowser plugin
|
||||
// is similar to native window.open signature, so the compiler can's
|
||||
// select proper overload, but we cast result to InAppBrowser manually.
|
||||
const iab = window.open('google.com', '_self');
|
||||
|
||||
iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
|
||||
iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); });
|
||||
iab.addEventListener('loadstop', (ev) => { console.log('loadstop' + ev.code); });
|
||||
iab.addEventListener('loaderror', (ev) => { console.log('loaderror' + ev.code); });
|
||||
iab.addEventListener('exit', (ev) => { console.log('exit' + ev.code); });
|
||||
|
||||
function inAppBrowserCallBack(ev: InAppBrowserEvent) {
|
||||
console.log('InAppBrowser callback ' + ev.url);
|
||||
}
|
||||
|
||||
iab.addEventListener('loadstart', inAppBrowserCallBack);
|
||||
iab.addEventListener('loadstart', inAppBrowserCallBack);
|
||||
iab.addEventListener('loadstop', inAppBrowserCallBack);
|
||||
iab.addEventListener('loaderror', inAppBrowserCallBack);
|
||||
iab.addEventListener('exit', inAppBrowserCallBack);
|
||||
|
||||
iab.removeEventListener('loadstart', inAppBrowserCallBack);
|
||||
iab.removeEventListener('loadstop', inAppBrowserCallBack);
|
||||
iab.removeEventListener('loaderror', inAppBrowserCallBack);
|
||||
iab.removeEventListener('exit', inAppBrowserCallBack);
|
||||
|
||||
iab.show();
|
||||
iab.executeScript(
|
||||
{ code: "console.log('Injected script in action')" },
|
||||
() => { console.log('Script is executed'); }
|
||||
);
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
// Type definitions for Apache Cordova InAppBrowser plugin 1.7
|
||||
// Project: https://github.com/apache/cordova-plugin-inappbrowser
|
||||
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
//
|
||||
// Copyright (c) Microsoft Open Technologies Inc
|
||||
// Licensed under the MIT license.
|
||||
// TypeScript Version: 2.3
|
||||
type channel = "loadstart" | "loadstop" | "loaderror" | "exit";
|
||||
|
||||
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?: 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: Event): 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 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: channel, callback: InAppBrowserEventListenerOrEventListenerObject): 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: channel, callback: InAppBrowserEventListenerOrEventListenerObject): void;
|
||||
/** Closes the InAppBrowser window. */
|
||||
close(): void;
|
||||
/** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */
|
||||
hide(): 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 } | { 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 } | { file: string }, callback: () => void): void;
|
||||
}
|
||||
|
||||
type InAppBrowserEventListenerOrEventListenerObject = InAppBrowserEventListener | InAppBrowserEventListenerObject;
|
||||
|
||||
type InAppBrowserEventListener = (evt: InAppBrowserEvent) => void;
|
||||
|
||||
interface InAppBrowserEventListenerObject {
|
||||
handleEvent(evt: InAppBrowserEvent): 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;
|
||||
}
|
||||
|
||||
interface Cordova {
|
||||
InAppBrowser: InAppBrowser;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-inappbrowser-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"dt-header": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
console.log('Supported audio modes are: ' + JSON.stringify(navigator.device.capture.supportedAudioModes));
|
||||
|
||||
navigator.device.capture.captureAudio(
|
||||
(captures: MediaFile[]) => { console.log(captures.length + ' captured'); },
|
||||
(err: CaptureError) => { alert('Error ' + err.message); },
|
||||
{
|
||||
limit: 3,
|
||||
duration: 10
|
||||
}
|
||||
);
|
||||
|
||||
-167
@@ -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/DefinitelyTyped/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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-media-capture-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// Media and Media Capture
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
var media = new Media('',
|
||||
() => { console.log('Media opened'); },
|
||||
(err: MediaError) => { alert('Error: ' + err.code); });
|
||||
media.play();
|
||||
media.setVolume(10);
|
||||
|
||||
-84
@@ -1,84 +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/DefinitelyTyped/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.
|
||||
* @param iosPlayOptions: iOS options quirks
|
||||
*/
|
||||
play(iosPlayOptions?: IosPlayOptions): 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;
|
||||
}
|
||||
/**
|
||||
* iOS optional parameters for media.play
|
||||
* See https://github.com/apache/cordova-plugin-media#ios-quirks
|
||||
*/
|
||||
interface IosPlayOptions {
|
||||
numberOfLoops?: number;
|
||||
playAudioWhenScreenIsLocked?: boolean;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-media-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
var connType = navigator.connection.type;
|
||||
if (connType == Connection.WIFI) {
|
||||
console.log('Congratulations, you\'re with fast Internet!');
|
||||
}
|
||||
|
||||
document.addEventListener('offline', () => { alert('You\'re offline!'); });
|
||||
@@ -1,62 +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/DefinitelyTyped/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: string;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var Connection: {
|
||||
UNKNOWN: string;
|
||||
ETHERNET: string;
|
||||
WIFI: string;
|
||||
CELL_2G: string;
|
||||
CELL_3G: string;
|
||||
CELL_4G: string;
|
||||
CELL: string;
|
||||
NONE: string;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-network-information-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
navigator.splashscreen.show();
|
||||
navigator.splashscreen.hide();
|
||||
-17
@@ -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/DefinitelyTyped/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,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-splashscreen-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
var statusBar: StatusBar = window.StatusBar;
|
||||
statusBar.overlaysWebView(true);
|
||||
statusBar.overlaysWebView(false);
|
||||
statusBar.styleDefault();
|
||||
statusBar.styleLightContent();
|
||||
statusBar.styleBlackTranslucent();
|
||||
statusBar.styleBlackOpaque();
|
||||
statusBar.backgroundColorByName("red");
|
||||
statusBar.backgroundColorByHexString("#aaa");
|
||||
statusBar.hide();
|
||||
statusBar.show();
|
||||
var visible: boolean = statusBar.isVisible;
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
// Type definitions for Apache Cordova StatusBar plugin
|
||||
// Project: https://github.com/apache/cordova-plugin-statusbar
|
||||
// Definitions by: Xinkai Chen <https://github.com/Xinkai>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Global object StatusBar.
|
||||
*/
|
||||
interface Window {
|
||||
StatusBar: StatusBar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The StatusBar object provides some functions to customize the iOS and Android StatusBar.
|
||||
*/
|
||||
interface StatusBar {
|
||||
/**
|
||||
* On iOS 7, make the statusbar overlay or not overlay the WebView.
|
||||
* @param isOverlay On iOS 7, set to false to make the statusbar appear like iOS 6.
|
||||
* Set the style and background color to suit using the other functions.
|
||||
*/
|
||||
overlaysWebView: (isOverlay: boolean) => void;
|
||||
|
||||
/**
|
||||
* Use the default statusbar (dark text, for light backgrounds).
|
||||
*/
|
||||
styleDefault: () => void;
|
||||
|
||||
/**
|
||||
* Use the lightContent statusbar (light text, for dark backgrounds).
|
||||
*/
|
||||
styleLightContent: () => void;
|
||||
|
||||
/**
|
||||
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
|
||||
*/
|
||||
styleBlackTranslucent: () => void;
|
||||
|
||||
/**
|
||||
* Use the blackOpaque statusbar (light text, for dark backgrounds).
|
||||
*/
|
||||
styleBlackOpaque: () => void;
|
||||
|
||||
/**
|
||||
* On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false,
|
||||
* you can set the background color of the statusbar by color name.
|
||||
* @param color Supported color names are:
|
||||
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
|
||||
*/
|
||||
backgroundColorByName: (color: string) => void;
|
||||
|
||||
/**
|
||||
* Sets the background color of the statusbar by a hex string.
|
||||
* @param color CSS shorthand properties are also supported.
|
||||
* On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by a hex string (#RRGGBB).
|
||||
* On WP7 and WP8 you can also specify values as #AARRGGBB, where AA is an alpha value
|
||||
*/
|
||||
backgroundColorByHexString: (color: string) => void;
|
||||
|
||||
/**
|
||||
* Hide the statusbar.
|
||||
*/
|
||||
hide: () => void;
|
||||
|
||||
/**
|
||||
* Show the statusbar.
|
||||
*/
|
||||
show: () => void;
|
||||
|
||||
/**
|
||||
* Read this property to see if the statusbar is visible or not.
|
||||
*/
|
||||
isVisible: boolean;
|
||||
}
|
||||
|
||||
declare var StatusBar: StatusBar;
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-statusbar-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
var notification: Notification;
|
||||
|
||||
notification.vibrate(100);
|
||||
notification.vibrateWithPattern([100, 200, 200, 150, 50], 3);
|
||||
setTimeout(notification.cancelVibration, 1000);
|
||||
|
||||
-45
@@ -1,45 +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>, Louis Lagrange <https://github.com/Minishlink>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
//
|
||||
// Copyright (c) Microsoft Open Technologies Inc
|
||||
// Licensed under the MIT license.
|
||||
|
||||
interface Navigator {
|
||||
/**
|
||||
* Vibrates the device for the specified amount of time.
|
||||
* @param time Milliseconds to vibrate the device. 0 cancels the vibration. Ignored on iOS.
|
||||
*/
|
||||
vibrate(time: number): void;
|
||||
|
||||
/**
|
||||
* Vibrates the device with a given pattern.
|
||||
* @param time Sequence of durations (in milliseconds) for which to turn on or off the vibrator. Ignored on iOS.
|
||||
*/
|
||||
vibrate(time: number[]): void;
|
||||
}
|
||||
|
||||
interface Notification {
|
||||
/**
|
||||
* Vibrates the device for the specified amount of time.
|
||||
* @param time Milliseconds to vibrate the device. Ignored on iOS.
|
||||
* @deprecated
|
||||
*/
|
||||
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).
|
||||
* @deprecated
|
||||
*/
|
||||
vibrateWithPattern(pattern: number[], repeat: number): void;
|
||||
/**
|
||||
* Immediately cancels any currently running vibration.
|
||||
* @deprecated
|
||||
*/
|
||||
cancelVibration(): void;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-vibration-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,584 +0,0 @@
|
||||
/// <reference types="cordova-plugin-device" />
|
||||
|
||||
cordova.plugins.diagnostic.isLocationAvailable(function(available){
|
||||
console.log("Location is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isWifiAvailable(function(available){
|
||||
console.log("WiFi is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCameraAvailable(function(available){
|
||||
console.log("Camera is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isBluetoothAvailable(function(available){
|
||||
console.log("Bluetooth is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.switchToLocationSettings();
|
||||
cordova.plugins.diagnostic.switchToMobileDataSettings();
|
||||
cordova.plugins.diagnostic.switchToBluetoothSettings();
|
||||
cordova.plugins.diagnostic.switchToWifiSettings();
|
||||
|
||||
cordova.plugins.diagnostic.isWifiEnabled(function(enabled){
|
||||
console.log("WiFi is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.setWifiState(function(){
|
||||
console.log("Wifi was enabled");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, true
|
||||
);
|
||||
|
||||
cordova.plugins.diagnostic.setBluetoothState(function(){
|
||||
console.log("Bluetooth was enabled");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, true
|
||||
);
|
||||
|
||||
cordova.plugins.diagnostic.isLocationEnabled(function(enabled){
|
||||
console.log("Location setting is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isLocationAuthorized(function(enabled){
|
||||
console.log("Location authorization is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getLocationAuthorizationStatus(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission not requested");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted always");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
|
||||
console.log("Permission granted only when in use");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestLocationAuthorization(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission not requested");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted always");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
|
||||
console.log("Permission granted only when in use");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
}, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS);
|
||||
|
||||
cordova.plugins.diagnostic.isCameraPresent(function(present){
|
||||
console.log("Camera is " + (present ? "present" : "absent"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCameraAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getCameraAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Camera use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestCameraAuthorization(function(status){
|
||||
console.log("Authorization request for camera use was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied"));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isMicrophoneAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to the microphone");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getMicrophoneAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Microphone use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestMicrophoneAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Microphone use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isContactsAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to contacts");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getContactsAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Contacts use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestContactsAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Contacts use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCalendarAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to calendar");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getCalendarAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Calendar use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestCalendarAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Calendar use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.switchToSettings(function(){
|
||||
console.log("Successfully switched to Settings app");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getBluetoothState(function(state){
|
||||
if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){
|
||||
console.log("Bluetooth is able to connect");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerBluetoothStateChangeHandler(function(state){
|
||||
if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){
|
||||
console.log("Bluetooth is able to connect");
|
||||
}
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerLocationStateChangeHandler(function(state){
|
||||
if((device.platform === "Android" && state !== cordova.plugins.diagnostic.locationMode.LOCATION_OFF)
|
||||
|| (device.platform === "iOS") && ( state === cordova.plugins.diagnostic.permissionStatus.GRANTED
|
||||
|| state === cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE
|
||||
)){
|
||||
console.log("Location is available");
|
||||
}
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getLocationMode(function(locationMode){
|
||||
switch(locationMode){
|
||||
case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY:
|
||||
console.log("High accuracy");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING:
|
||||
console.log("Battery saving");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY:
|
||||
console.log("Device only");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.LOCATION_OFF:
|
||||
console.log("Location off");
|
||||
break;
|
||||
}
|
||||
},function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isGpsLocationAvailable(function(available){
|
||||
console.log("GPS location is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isGpsLocationEnabled(function(enabled){
|
||||
console.log("GPS location is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNetworkLocationAvailable(function(available){
|
||||
console.log("Network location is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNetworkLocationEnabled(function(enabled){
|
||||
console.log("Network location is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getLocationMode(function(locationMode){
|
||||
switch(locationMode){
|
||||
case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY:
|
||||
console.log("High accuracy");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING:
|
||||
console.log("Battery saving");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY:
|
||||
console.log("Device only");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.LOCATION_OFF:
|
||||
console.log("Location off");
|
||||
break;
|
||||
}
|
||||
},function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use the camera");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use the camera has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use the camera - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use the camera - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, cordova.plugins.diagnostic.permission.CAMERA);
|
||||
|
||||
cordova.plugins.diagnostic.getPermissionsAuthorizationStatus(function(statuses){
|
||||
for (var permission in statuses){
|
||||
switch(statuses[permission]){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use "+permission+" has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use "+permission+" - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
},[
|
||||
cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION,
|
||||
cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION
|
||||
]);
|
||||
|
||||
cordova.plugins.diagnostic.requestRuntimePermission(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use the camera");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use the camera has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use the camera - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use the camera - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, cordova.plugins.diagnostic.permission.CAMERA);
|
||||
|
||||
cordova.plugins.diagnostic.requestRuntimePermissions(function(statuses){
|
||||
for (var permission in statuses){
|
||||
switch(statuses[permission]){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use "+permission+" has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use "+permission+" - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
},[
|
||||
cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION,
|
||||
cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION
|
||||
]);
|
||||
|
||||
if(!cordova.plugins.diagnostic.isRequestingPermission()){
|
||||
console.log("Request some permissions");
|
||||
}else{
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(function(statuses){
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler after single call
|
||||
console.log("Request some permissions");
|
||||
});
|
||||
}
|
||||
|
||||
function onPermissionRequestComplete(statuses:any){
|
||||
console.info("Permission request complete");
|
||||
for (var permission in statuses){
|
||||
switch(statuses[permission]){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use "+permission+" has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use "+permission);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler
|
||||
}
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(onPermissionRequestComplete)
|
||||
|
||||
cordova.plugins.diagnostic.isBluetoothEnabled(function(enabled){
|
||||
console.log("Bluetooth is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.hasBluetoothSupport(function(supported){
|
||||
console.log("Bluetooth is " + (supported ? "supported" : "unsupported"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.hasBluetoothLESupport(function(supported){
|
||||
console.log("Bluetooth LE is " + (supported ? "supported" : "unsupported"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.hasBluetoothLEPeripheralSupport(function(supported){
|
||||
console.log("Bluetooth LE Peripheral Mode is " + (supported ? "supported" : "unsupported"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCameraRollAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera roll");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getCameraRollAuthorizationStatus(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission not requested");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestCameraRollAuthorization(function(status){
|
||||
console.log("Authorization request for camera roll was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied"));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(enabled){
|
||||
console.log("Remote notifications are " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isRegisteredForRemoteNotifications(function(registered){
|
||||
console.log("Device " + (registered ? "is" : "isn't") + " registered for remote notifications");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getRemoteNotificationTypes(function(types){
|
||||
for(var type in types){
|
||||
console.log(type + " is " + (types[type] ? "enabled" : "disabled"));
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isRemindersAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to reminders");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getRemindersAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Reminders authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestRemindersAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Reminders authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isBackgroundRefreshAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "not authorized") + " to perform background refresh");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getBackgroundRefreshStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Background refresh is allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestBluetoothAuthorization(function(){
|
||||
console.log("Bluetooth authorization requested");
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isMotionAvailable(function(available){
|
||||
console.log("Motion tracking is " + (available ? "available" : "not available") + " on this device");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isMotionRequestOutcomeAvailable(function(available){
|
||||
console.log("Motion tracking request outcome is " + (available ? "available" : "not available") + " on this device");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestAndCheckMotionAuthorization(function(status){
|
||||
console.log("Motion authorization is " +status);
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isExternalStorageAuthorized(function(authorized){
|
||||
console.log("Location authorization is " + (authorized ? "authorized" : "unauthorized"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("External storage authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestExternalStorageAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("External storage authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getExternalSdCardDetails(function(details){
|
||||
console.log("External SD card details: " + JSON.stringify(details));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCPresent(function(present){
|
||||
console.log("NFC hardware is " + (present ? "present" : "absent"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCEnabled(function(enabled){
|
||||
console.log("NFC is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCAvailable(function(available){
|
||||
console.log("NFC is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerNFCStateChangeHandler(function(state){
|
||||
if(state === cordova.plugins.diagnostic.NFCState.POWERED_ON){
|
||||
console.log("NFC is ready to use");
|
||||
}
|
||||
});
|
||||
-833
@@ -1,833 +0,0 @@
|
||||
// Type definitions for cordova.plugins.diagnostic v3.4.x
|
||||
// Project: https://github.com/dpa99c/cordova-diagnostic-plugin
|
||||
// Definitions by: Dave Alden <https://github.com/dpa99c>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="cordova" />
|
||||
|
||||
/**
|
||||
* Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
|
||||
*/
|
||||
interface Diagnostic {
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* "Dangerous" permissions that need to be requested at run-time (Android 6.0/API 23 and above)
|
||||
* See http://developer.android.com/guide/topics/security/permissions.html#perm-groups
|
||||
* @type {Object}
|
||||
*/
|
||||
permission?: any;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Permission groups indicate which associated permissions will also be requested if a given permission is requested.
|
||||
* See http://developer.android.com/guide/topics/security/permissions.html#perm-groups
|
||||
* @type {Object}
|
||||
*/
|
||||
permissionGroups?: any;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Constants for requesting and reporting the various permission states.
|
||||
* @type {Object}
|
||||
*/
|
||||
permissionStatus?: any;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Location authorization mode
|
||||
* @type {Object}
|
||||
*/
|
||||
locationAuthorizationMode?: any;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Constants for the various location modes on Android.
|
||||
* @type {Object}
|
||||
*/
|
||||
locationMode?: any;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Constants for the various Bluetooth hardware states.
|
||||
* @type {Object}
|
||||
*/
|
||||
bluetoothState?: any;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Constants for the various NFC power states.
|
||||
* @type {Object}
|
||||
*/
|
||||
NFCState?: any;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isLocationAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Checks if Wifi is available.
|
||||
* On iOS this returns true if the device is connected to a network by WiFi.
|
||||
* On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled, and is the same as isWifiEnabled()
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isWifiAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Checks if camera is available.
|
||||
* On Android & iOS this returns true if the device has a camera AND the application is authorized to use it.
|
||||
* On Windows 10 Mobile this returns true if the device has a rear-facing camera.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Checks if Bluetooth is available to the app.
|
||||
* Returns true if the device has Bluetooth capabilities AND if Bluetooth setting is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isBluetoothAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays the device location settings to allow user to enable location services/change location mode.
|
||||
*/
|
||||
switchToLocationSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays mobile settings to allow user to enable mobile data.
|
||||
*/
|
||||
switchToMobileDataSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays Bluetooth settings to allow user to enable Bluetooth.
|
||||
*/
|
||||
switchToBluetoothSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays WiFi settings to allow user to enable WiFi.
|
||||
*/
|
||||
switchToWifiSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Returns true if the WiFi setting is set to enabled, and is the same as isWifiAvailable()
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isWifiEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Enables/disables WiFi on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param state
|
||||
*/
|
||||
setWifiState?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
state: boolean
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Enables/disables Bluetooth on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param state
|
||||
*/
|
||||
setBluetoothState?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
state: boolean
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns true if the device setting for location is on.
|
||||
* On Android this returns true if Location Mode is switched on.
|
||||
* On iOS this returns true if Location Services is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isLocationEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isLocationAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the location authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getLocationAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests location authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param mode - (iOS-only / optional) location authorization mode specified as a locationAuthorizationMode constant. If not specified, defaults to WHEN_IN_USE.
|
||||
*/
|
||||
requestLocationAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
mode?: string
|
||||
) => void;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if camera hardware is present on device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraPresent?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use the camera.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the camera authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getCameraAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests camera authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestCameraAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use the microphone.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isMicrophoneAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the microphone authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getMicrophoneAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests microphone authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestMicrophoneAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use contacts (address book).
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isContactsAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the contacts authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getContactsAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests contacts authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestContactsAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use the calendar.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCalendarAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the calendar authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getCalendarAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests calendar authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestCalendarAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Opens settings page for this app.
|
||||
* On Android, this opens the "App Info" page in the Settings app.
|
||||
* On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
|
||||
*/
|
||||
switchToSettings?: (
|
||||
successCallback: () => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the state of Bluetooth on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getBluetoothState?: (
|
||||
successCallback: (state: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Registers a function to be called when a change in Bluetooth state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerBluetoothStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Registers a function to be called when a change in Location state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* On Android, this occurs when the Location Mode is changed.
|
||||
* On iOS, this occurs when location authorization status is changed. This can be triggered either by the user's response to a location permission authorization dialog, by the user turning on/off Location Services, or by the user changing the Location authorization state specifically for your app.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerLocationStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if high-accuracy locations are available to the app from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isGpsLocationAvailable?: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device location setting is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either Device only or High accuracy
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isGpsLocationEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
|
||||
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNetworkLocationAvailable?: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device location setting is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either Battery saving or High accuracy
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNetworkLocationEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the current location mode setting for the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getLocationMode?: (
|
||||
successCallback: (mode: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the current authorisation status for a given permission.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permission
|
||||
*/
|
||||
getPermissionAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permission: string
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the current authorisation status for multiple permissions.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permissions
|
||||
*/
|
||||
getPermissionsAuthorizationStatus?: (
|
||||
successCallback: (status: string[]) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permissions: string[]
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests app to be granted authorisation for a runtime permission.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permission
|
||||
*/
|
||||
requestRuntimePermission?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permission: string
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests app to be granted authorisation for multiple runtime permissions.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permissions
|
||||
*/
|
||||
requestRuntimePermissions?: (
|
||||
successCallback: (status: string[]) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permissions: string[]
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Indicates if the plugin is currently requesting a runtime permission via the native API.
|
||||
*/
|
||||
isRequestingPermission?: () => boolean;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Registers a function to be called when a runtime permission request has completed. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerPermissionRequestCompleteHandler?: (
|
||||
successCallback: (statuses: any) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device setting for Bluetooth is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isBluetoothEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device has Bluetooth capabilities.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
hasBluetoothSupport?: (
|
||||
successCallback: (supported: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
hasBluetoothLESupport?: (
|
||||
successCallback: (supported: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
hasBluetoothLEPeripheralSupport?: (
|
||||
successCallback: (supported: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the application is authorized to use external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isExternalStorageAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the authorisation status for runtime permission to use the external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getExternalStorageAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests authorisation for runtime permission to use the external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestExternalStorageAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns details of external SD card(s): absolute path, is writable, free space
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getExternalSdCardDetails?: (
|
||||
successCallback: (status: any) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if NFC hardware is present on device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCPresent?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device setting for NFC is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCEnabled?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if NFC is available to the app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCAvailable?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Registers a function to be called when a change in NFC state occurs.
|
||||
* Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerNFCStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraRollAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Returns the authorization status for the application to use the Camera Roll in Photos app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getCameraRollAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Requests camera roll authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestCameraRollAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isRemoteNotificationsEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isRegisteredForRemoteNotifications?: (
|
||||
successCallback: (registered: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Indicates the current setting of notification types for the app in the Settings app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getRemoteNotificationTypes?: (
|
||||
successCallback: (types: any) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized to use reminders.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isRemindersAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Returns the reminders authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getRemindersAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Requests reminders authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestRemindersAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized for background refresh.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isBackgroundRefreshAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Returns the background refresh authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getBackgroundRefreshStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Requests Bluetooth authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestBluetoothAuthorization?: (
|
||||
successCallback: () => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if motion tracking is available on the current device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isMotionAvailable?: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if it's possible to determine the outcome of a motion authorization request on the current device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isMotionRequestOutcomeAvailable?: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Requests and checks motion authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestAndCheckMotionAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
}
|
||||
|
||||
interface CordovaPlugins {
|
||||
diagnostic: Diagnostic
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova.plugins.diagnostic-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"cordova-plugin-camera": "^3.0.0",
|
||||
"cordova-plugin-file": "^5.0.0",
|
||||
"cordova-plugin-file-transfer": "^1.7.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user