🍙POGOserver - Porting POGOserver to Visual Studio -rev5

This commit is contained in:
--=FurtiF™=-- 2016-11-06 11:45:15 +01:00
parent efc1eccc49
commit 95af8fb943
29 changed files with 2809 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// Polyfill pour la prise en charge de Function.prototype.bind() sur Android 2.3
(function () {
if (!Function.prototype.bind) {
Function.prototype.bind = function (thisValue) {
if (typeof this !== "function") {
throw new TypeError(this + " cannot be bound as it is not a function");
}
// bind() permet également d'ajouter des arguments au début de l'appel
var preArgs = Array.prototype.slice.call(arguments, 1);
// Fonction réelle à laquelle lier la valeur et les arguments "this"
var functionToBind = this;
var noOpFunction = function () { };
// Argument "this" à utiliser
var thisArg = this instanceof noOpFunction && thisValue ? this : thisValue;
// Fonction liée résultante
var boundFunction = function () {
return functionToBind.apply(thisArg, preArgs.concat(Array.prototype.slice.call(arguments)));
};
noOpFunction.prototype = this.prototype;
boundFunction.prototype = new noOpFunction();
return boundFunction;
};
}
}());

View File

@ -0,0 +1,10 @@
(function () {
// Ajouter le polyfill bind()
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src', 'scripts/android2.3-jscompat.js');
if (document.body) {
document.body.appendChild(scriptElem);
} else {
document.head.appendChild(scriptElem);
}
}());

View File

@ -0,0 +1,10 @@
(function () {
// Ajouter le polyfill safeHTML
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src', 'scripts/winstore-jscompat.js');
if (document.body) {
document.body.appendChild(scriptElem);
} else {
document.head.appendChild(scriptElem);
}
}());

View File

@ -0,0 +1,176 @@
// Copyright (c) Microsoft Open Technologies, Inc. Tous droits réservés.
// Sous licence Apache, version 2.0.
// Consultez http://www.apache.org/licenses/LICENSE-2.0.html.
// Shim de contenu dynamique JavaScript pour applications du Windows Store
(function () {
if (window.MSApp && MSApp.execUnsafeLocalFunction) {
// Certains nœuds ont une propriété "attributes" qui masque la propriété Node.prototype.attributes
// ce qui signifie que nous ne voyons pas réellement les attributs de Node (curieusement, la console de débogage VS
// semble affectée par le même problème).
//
var Element_setAttribute = Object.getOwnPropertyDescriptor(Element.prototype, "setAttribute").value;
var Element_removeAttribute = Object.getOwnPropertyDescriptor(Element.prototype, "removeAttribute").value;
var HTMLElement_insertAdjacentHTMLPropertyDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, "insertAdjacentHTML");
var Node_get_attributes = Object.getOwnPropertyDescriptor(Node.prototype, "attributes").get;
var Node_get_childNodes = Object.getOwnPropertyDescriptor(Node.prototype, "childNodes").get;
var detectionDiv = document.createElement("div");
function getAttributes(element) {
return Node_get_attributes.call(element);
}
function setAttribute(element, attribute, value) {
try {
Element_setAttribute.call(element, attribute, value);
} catch (e) {
// ignorer
}
}
function removeAttribute(element, attribute) {
Element_removeAttribute.call(element, attribute);
}
function childNodes(element) {
return Node_get_childNodes.call(element);
}
function empty(element) {
while (element.childNodes.length) {
element.removeChild(element.lastChild);
}
}
function insertAdjacentHTML(element, position, html) {
HTMLElement_insertAdjacentHTMLPropertyDescriptor.value.call(element, position, html);
}
function inUnsafeMode() {
var isUnsafe = true;
try {
detectionDiv.innerHTML = "<test/>";
}
catch (ex) {
isUnsafe = false;
}
return isUnsafe;
}
function cleanse(html, targetElement) {
var cleaner = document.implementation.createHTMLDocument("cleaner");
empty(cleaner.documentElement);
MSApp.execUnsafeLocalFunction(function () {
insertAdjacentHTML(cleaner.documentElement, "afterbegin", html);
});
var scripts = cleaner.documentElement.querySelectorAll("script");
Array.prototype.forEach.call(scripts, function (script) {
switch (script.type.toLowerCase()) {
case "":
script.type = "text/inert";
break;
case "text/javascript":
case "text/ecmascript":
case "text/x-javascript":
case "text/jscript":
case "text/livescript":
case "text/javascript1.1":
case "text/javascript1.2":
case "text/javascript1.3":
script.type = "text/inert-" + script.type.slice("text/".length);
break;
case "application/javascript":
case "application/ecmascript":
case "application/x-javascript":
script.type = "application/inert-" + script.type.slice("application/".length);
break;
default:
break;
}
});
function cleanseAttributes(element) {
var attributes = getAttributes(element);
if (attributes && attributes.length) {
// comme la collection d'attributs est dynamique, il est plus simple de mettre en file d'attente les changements de noms
var events;
for (var i = 0, len = attributes.length; i < len; i++) {
var attribute = attributes[i];
var name = attribute.name;
if ((name[0] === "o" || name[0] === "O") &&
(name[1] === "n" || name[1] === "N")) {
events = events || [];
events.push({ name: attribute.name, value: attribute.value });
}
}
if (events) {
for (var i = 0, len = events.length; i < len; i++) {
var attribute = events[i];
removeAttribute(element, attribute.name);
setAttribute(element, "x-" + attribute.name, attribute.value);
}
}
}
var children = childNodes(element);
for (var i = 0, len = children.length; i < len; i++) {
cleanseAttributes(children[i]);
}
}
cleanseAttributes(cleaner.documentElement);
var cleanedNodes = [];
if (targetElement.tagName === 'HTML') {
cleanedNodes = Array.prototype.slice.call(document.adoptNode(cleaner.documentElement).childNodes);
} else {
if (cleaner.head) {
cleanedNodes = cleanedNodes.concat(Array.prototype.slice.call(document.adoptNode(cleaner.head).childNodes));
}
if (cleaner.body) {
cleanedNodes = cleanedNodes.concat(Array.prototype.slice.call(document.adoptNode(cleaner.body).childNodes));
}
}
return cleanedNodes;
}
function cleansePropertySetter(property, setter) {
var propertyDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, property);
var originalSetter = propertyDescriptor.set;
Object.defineProperty(HTMLElement.prototype, property, {
get: propertyDescriptor.get,
set: function (value) {
if (window.WinJS && window.WinJS._execUnsafe && inUnsafeMode()) {
originalSetter.call(this, value);
} else {
var that = this;
var nodes = cleanse(value, that);
MSApp.execUnsafeLocalFunction(function () {
setter(propertyDescriptor, that, nodes);
});
}
},
enumerable: propertyDescriptor.enumerable,
configurable: propertyDescriptor.configurable,
});
}
cleansePropertySetter("innerHTML", function (propertyDescriptor, target, elements) {
empty(target);
for (var i = 0, len = elements.length; i < len; i++) {
target.appendChild(elements[i]);
}
});
cleansePropertySetter("outerHTML", function (propertyDescriptor, target, elements) {
for (var i = 0, len = elements.length; i < len; i++) {
target.insertAdjacentElement("afterend", elements[i]);
}
target.parentNode.removeChild(target);
});
}
}());

39
scripts/index.ts Normal file
View File

@ -0,0 +1,39 @@
// Pour obtenir une présentation du modèle Vide, consultez la documentation suivante :
// http://go.microsoft.com/fwlink/?LinkID=397705
// Pour déboguer du code durant le chargement d'une page dans Ripple ou sur les appareils/émulateurs Android, lancez votre application, définissez des points d'arrêt,
// puis exécutez "window.location.reload()" dans la console JavaScript.
module BlankCordovaApp1 {
"use strict";
export module Application {
export function initialize() {
document.addEventListener('deviceready', onDeviceReady, false);
}
function onDeviceReady() {
// Gérer les événements de suspension et de reprise Cordova
document.addEventListener('pause', onPause, false);
document.addEventListener('resume', onResume, false);
// TODO: Cordova a été chargé. Effectuez l'initialisation qui nécessite Cordova ici.
var parentElement = document.getElementById('deviceready');
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
}
function onPause() {
// TODO: cette application a été suspendue. Enregistrez l'état de l'application ici.
}
function onResume() {
// TODO: cette application a été réactivée. Restaurez l'état de l'application ici.
}
}
window.onload = function () {
Application.initialize();
}
}

11
scripts/tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"inlineSources": true,
"out": "www/scripts/appBundle.js",
"target": "es5"
}
}

92
scripts/typings/cordova/cordova.d.ts vendored Normal file
View File

@ -0,0 +1,92 @@
// Type definitions for Apache Cordova
// Project: http://cordova.apache.org
// Definitions by: Microsoft Open Technologies Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/// <reference path="plugins/BatteryStatus.d.ts"/>
/// <reference path="plugins/Camera.d.ts"/>
/// <reference path="plugins/Contacts.d.ts"/>
/// <reference path="plugins/Device.d.ts"/>
/// <reference path="plugins/DeviceMotion.d.ts"/>
/// <reference path="plugins/DeviceOrientation.d.ts"/>
/// <reference path="plugins/Dialogs.d.ts"/>
/// <reference path="plugins/FileSystem.d.ts"/>
/// <reference path="plugins/FileTransfer.d.ts"/>
/// <reference path="plugins/Globalization.d.ts"/>
/// <reference path="plugins/InAppBrowser.d.ts"/>
/// <reference path="plugins/Media.d.ts"/>
/// <reference path="plugins/MediaCapture.d.ts"/>
/// <reference path="plugins/NetworkInformation.d.ts"/>
/// <reference path="plugins/Push.d.ts"/>
/// <reference path="plugins/Splashscreen.d.ts"/>
/// <reference path="plugins/StatusBar.d.ts"/>
/// <reference path="plugins/Vibration.d.ts"/>
/// <reference path="plugins/WebSQL.d.ts"/>
interface Cordova {
/** Invokes native functionality by specifying corresponding service name, action and optional parameters.
* @param success A success callback function.
* @param fail An error callback function.
* @param service The service name to call on the native side (corresponds to a native class).
* @param action The action name to call on the native side (generally corresponds to the native class method).
* @param args An array of arguments to pass into the native environment.
*/
exec(success: () => any, fail: () => any, service: string, action: string, args?: string[]): void;
/** Gets the operating system name. */
platformId: string;
/** Gets Cordova framework version */
version: string;
/** Defines custom logic as a Cordova module. Other modules can later access it using module name provided. */
define(moduleName: string, factory: (require: any, exports: any, module: any) => any): void;
/** Access a Cordova module by name. */
require(moduleName: string): any;
}
interface Document {
addEventListener(type: "deviceready", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "resume", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "backbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "menubutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "searchbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "startcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "endcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "volumedownbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "volumeupbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "deviceready", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "resume", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "backbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "menubutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "searchbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "startcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "endcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "volumedownbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: "volumeupbutton", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
}
interface Window {
cordova:Cordova;
}
// cordova/argscheck module
interface ArgsCheck {
checkArgs(argsSpec: string, functionName: string, args: any[], callee?: any): void;
getValue(value?: any, defaultValue?: any): any;
enableChecks: boolean;
}
// cordova/urlutil module
interface UrlUtil {
makeAbsolute(url: string): string
}
/** Apache Cordova instance */
declare var cordova: Cordova;

View File

@ -0,0 +1,125 @@
// Type definitions for Apache Cordova BatteryStatus plugin.
// Project: https://github.com/apache/cordova-plugin-battery-status
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
onbatterystatus: (type: BatteryStatusEvent) => void;
onbatterycritical: (type: BatteryStatusEvent) => void;
onbatterylow: (type: BatteryStatusEvent) => void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
}
/** Object, that passed into battery event listener */
interface BatteryStatusEvent extends Event {
/* The percentage of battery charge (0-100). */
level: number;
/* A boolean that indicates whether the device is plugged in. */
isPlugged: boolean;
}

View File

@ -0,0 +1,174 @@
// Type definitions for Apache Cordova Camera plugin.
// Project: https://github.com/apache/cordova-plugin-camera
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides an API for taking pictures and for choosing images from the system's image library.
*/
camera: Camera;
}
/**
* This plugin provides an API for taking pictures and for choosing images from the system's image library.
*/
interface Camera {
/**
* Removes intermediate photos taken by the camera from temporary storage.
* @param onSuccess Success callback, that called when cleanup succeeds.
* @param onError Error callback, that get an error message.
*/
cleanup(
onSuccess: () => void,
onError: (message: string) => void): void;
/**
* Takes a photo using the camera, or retrieves a photo from the device's image gallery.
* @param cameraSuccess Success callback, that get the image
* as a base64-encoded String, or as the URI for the image file.
* @param cameraError Error callback, that get an error message.
* @param cameraOptions Optional parameters to customize the camera settings.
*/
getPicture(
cameraSuccess: (data: string) => void,
cameraError: (message: string) => void,
cameraOptions?: CameraOptions): void;
// Next will work only on iOS
//getPicture(
// cameraSuccess: (data: string) => void,
// cameraError: (message: string) => void,
// cameraOptions?: CameraOptions): CameraPopoverHandle;
}
interface CameraOptions {
/** Picture quality in range 0-100. Default is 50 */
quality?: number;
/**
* Choose the format of the return value.
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
* DATA_URL : 0, Return image as base64-encoded string
* FILE_URI : 1, Return image file URI
* NATIVE_URI : 2 Return image native URI
* (e.g., assets-library:// on iOS or content:// on Android)
*/
destinationType?: number;
/**
* Set the source of the picture.
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
* PHOTOLIBRARY : 0,
* CAMERA : 1,
* SAVEDPHOTOALBUM : 2
*/
sourceType?: number;
/** Allow simple editing of image before selection. */
allowEdit?: boolean;
/**
* Choose the returned image file's encoding.
* Defined in navigator.camera.EncodingType. Default is JPEG
* JPEG : 0 Return JPEG encoded image
* PNG : 1 Return PNG encoded image
*/
encodingType?: number;
/**
* Width in pixels to scale image. Must be used with targetHeight.
* Aspect ratio remains constant.
*/
targetWidth?: number;
/**
* Height in pixels to scale image. Must be used with targetWidth.
* Aspect ratio remains constant.
*/
targetHeight?: number;
/**
* Set the type of media to select from. Only works when PictureSourceType
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
* Will return format specified via DestinationType
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
* ALLMEDIA : 2 allow selection from all media types
*/
mediaType?: number;
/** Rotate the image to correct for the orientation of the device during capture. */
correctOrientation?: boolean;
/** Save the image to the photo album on the device after capture. */
saveToPhotoAlbum?: boolean;
/**
* Choose the camera to use (front- or back-facing).
* Defined in navigator.camera.Direction. Default is BACK.
* FRONT: 0
* BACK: 1
*/
cameraDirection?: number;
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
popoverOptions?: CameraPopoverOptions;
}
/**
* A handle to the popover dialog created by navigator.camera.getPicture. Used on iOS only.
*/
interface CameraPopoverHandle {
/**
* Set the position of the popover.
* @param popoverOptions the CameraPopoverOptions that specify the new position.
*/
setPosition(popoverOptions: CameraPopoverOptions): void;
}
/**
* iOS-only parameters that specify the anchor element location and arrow direction
* of the popover when selecting images from an iPad's library or album.
*/
interface CameraPopoverOptions {
x: number;
y: number;
width: number;
height: number;
/**
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
* Matches iOS UIPopoverArrowDirection constants.
* ARROW_UP : 1,
* ARROW_DOWN : 2,
* ARROW_LEFT : 4,
* ARROW_RIGHT : 8,
* ARROW_ANY : 15
*/
arrowDir : number;
}
declare var Camera: {
// Camera constants, defined in Camera plugin
DestinationType: {
DATA_URL: number;
FILE_URI: number;
NATIVE_URI: number
}
Direction: {
BACK: number;
FRONT: number;
}
EncodingType: {
JPEG: number;
PNG: number;
}
MediaType: {
PICTURE: number;
VIDEO: number;
ALLMEDIA: number;
}
PictureSourceType: {
PHOTOLIBRARY: number;
CAMERA: number;
SAVEDPHOTOALBUM: number;
}
// Used only on iOS
PopoverArrowDirection: {
ARROW_UP: number;
ARROW_DOWN: number;
ARROW_LEFT: number;
ARROW_RIGHT: number;
ARROW_ANY: number;
}
};

View File

@ -0,0 +1,273 @@
// Type definitions for Apache Cordova Contacts plugin.
// Project: https://github.com/apache/cordova-plugin-contacts
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** Provides access to the device contacts database. */
contacts: Contacts;
}
interface Contacts {
/**
* The navigator.contacts.create method is synchronous, and returns a new Contact object.
* This method does not retain the Contact object in the device contacts database,
* for which you need to invoke the Contact.save method.
* @param properties Object with contact fields
*/
create(properties?: ContactProperties): Contact;
/**
* The navigator.contacts.find method executes asynchronously, querying the device contacts database
* and returning an array of Contact objects. The resulting objects are passed to the onSuccess
* callback function specified by the onSuccess parameter.
* @param fields The fields parameter specifies the fields to be used as a search qualifier,
* and only those results are passed to the onSuccess callback function. A zero-length fields parameter
* is invalid and results in ContactError.INVALID_ARGUMENT_ERROR. A contactFields value of "*" returns all contact fields.
* @param onSuccess Success callback function invoked with the array of Contact objects returned from the database
* @param onError Error callback function, invoked when an error occurs.
* @param options Search options to filter navigator.contacts.
*/
find(fields: string[],
onSuccess: (contacts: Contact[]) => void,
onError: (error: ContactError) => void,
options?: ContactFindOptions): void;
/**
* The navigator.contacts.pickContact method launches the Contact Picker to select a single contact.
* The resulting object is passed to the contactSuccess callback function specified by the contactSuccess parameter.
* @param onSuccess Success callback function invoked with the array of Contact objects returned from the database
* @param onError Error callback function, invoked when an error occurs.
*/
pickContact(onSuccess: (contact: Contact) => void,
onError: (error: ContactError) => void): void
}
interface ContactProperties {
/** A globally unique identifier. */
id?: string;
/** The name of this Contact, suitable for display to end users. */
displayName?: string;
/** An object containing all components of a persons name. */
name?: ContactName;
/** A casual name by which to address the contact. */
nickname?: string;
/** An array of all the contact's phone numbers. */
phoneNumbers?: ContactField[];
/** An array of all the contact's email addresses. */
emails?: ContactField[];
/** An array of all the contact's addresses. */
addresses?: ContactAddress[];
/** An array of all the contact's IM addresses. */
ims?: ContactField[];
/** An array of all the contact's organizations. */
organizations?: ContactOrganization[];
/** The birthday of the contact. */
birthday?: Date;
/** A note about the contact. */
note?: string;
/** An array of the contact's photos. */
photos?: ContactField[];
/** An array of all the user-defined categories associated with the contact. */
categories?: ContactField[];
/** An array of web pages associated with the contact. */
urls?: ContactField[];
}
/**
* The Contact object represents a user's contact. Contacts can be created, stored, or removed
* from the device contacts database. Contacts can also be retrieved (individually or in bulk)
* from the database by invoking the navigator.contacts.find method.
*/
interface Contact extends ContactProperties {
/**
* Returns a new Contact object that is a deep copy of the calling object, with the id property set to null
*/
clone(): Contact;
/**
* Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object.
* @param onSuccess Success callback function invoked on success operation.
* @param onError Error callback function, invoked when an error occurs.
*/
remove(
onSuccess: () => void,
onError: (error: Error) => void): void;
/**
* Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists.
* @param onSuccess Success callback function invoked on success operation with che Contact object.
* @param onError Error callback function, invoked when an error occurs.
*/
save(
onSuccess: (contact: Contact) => void,
onError: (error: Error) => void): void;
}
declare var Contact: {
/** Constructor of Contact object */
new(id?: string,
displayName?: string,
name?: ContactName,
nickname?: string,
phoneNumbers?: ContactField[],
emails?: ContactField[],
addresses?: ContactAddress[],
ims?: ContactField[],
organizations?: ContactOrganization[],
birthday?: Date,
note?: string,
photos?: ContactField[],
categories?: ContactField,
urls?: ContactField[]): Contact
};
/** The ContactError object is returned to the user through the contactError callback function when an error occurs. */
interface ContactError {
/** Error code */
code: number;
/** Error message */
message: string;
}
declare var ContactError: {
new(code: number): ContactError;
UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number;
TIMEOUT_ERROR: number;
PENDING_OPERATION_ERROR: number;
IO_ERROR: number;
NOT_SUPPORTED_ERROR: number;
PERMISSION_DENIED_ERROR: number
};
/** Contains different kinds of information about a Contact object's name. */
interface ContactName {
/** The complete name of the contact. */
formatted?: string;
/** The contact's family name. */
familyName?: string;
/** The contact's given name. */
givenName?: string;
/** The contact's middle name. */
middleName?: string;
/** The contact's prefix (example Mr. or Dr.) */
honorificPrefix?: string;
/** The contact's suffix (example Esq.). */
honorificSuffix?: string;
}
declare var ContactName: {
/** Constructor for ContactName object */
new(formatted?: string,
familyName?: string,
givenName?: string,
middleName?: string,
honorificPrefix?: string,
honorificSuffix?: string): ContactName
};
/**
* The ContactField object is a reusable component that represents contact fields generically.
* Each ContactField object contains a value, type, and pref property. A Contact object stores
* several properties in ContactField[] arrays, such as phone numbers and email addresses.
*
* In most instances, there are no pre-determined values for a ContactField object's type attribute.
* For example, a phone number can specify type values of home, work, mobile, iPhone,
* or any other value that is supported by a particular device platform's contact database.
* However, for the Contact photos field, the type field indicates the format of the returned image:
* url when the value attribute contains a URL to the photo image, or base64 when the value
* contains a base64-encoded image string.
*/
interface ContactField {
/** A string that indicates what type of field this is, home for example. */
type: string;
/** The value of the field, such as a phone number or email address. */
value: string;
/** Set to true if this ContactField contains the user's preferred value. */
pref: boolean;
}
declare var ContactField: {
/** Constructor for ContactField object */
new(type?: string,
value?: string,
pref?: boolean): ContactField
};
/**
* The ContactAddress object stores the properties of a single address of a contact.
* A Contact object may include more than one address in a ContactAddress[] array.
*/
interface ContactAddress {
/** Set to true if this ContactAddress contains the user's preferred value. */
pref?: boolean;
/** A string indicating what type of field this is, home for example. */
type?: string;
/** The full address formatted for display. */
formatted?: string;
/** The full street address. */
streetAddress?: string;
/** The city or locality. */
locality?: string;
/** The state or region. */
region?: string;
/** The zip code or postal code. */
postalCode?: string;
/** The country name. */
country?: string;
}
declare var ContactAddress: {
/** Constructor of ContactAddress object */
new(pref?: boolean,
type?: string,
formatted?: string,
streetAddress?: string,
locality?: string,
region?: string,
postalCode?: string,
country?: string): ContactAddress
};
/**
* The ContactOrganization object stores a contact's organization properties. A Contact object stores
* one or more ContactOrganization objects in an array.
*/
interface ContactOrganization {
/** Set to true if this ContactOrganization contains the user's preferred value. */
pref?: boolean;
/** A string that indicates what type of field this is, home for example. */
type?: string;
/** The name of the organization. */
name?: string;
/** The department the contract works for. */
department?: string;
/** The contact's title at the organization. */
title?: string;
}
declare var ContactOrganization: {
/** Constructor for ContactOrganization object */
new(pref?: boolean,
type?: string,
name?: string,
department?: string,
title?: string): ContactOrganization
};
/** Search options to filter navigator.contacts. */
interface ContactFindOptions {
/** The search string used to find navigator.contacts. */
filter?: string;
/** Determines if the find operation returns multiple navigator.contacts. */
multiple?: boolean;
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
desiredFields?: string[];
}
declare var ContactFindOptions: {
/** Constructor for ContactFindOptions object */
new(filter?: string,
multiple?: boolean,
desiredFields?: string[]): ContactFindOptions
};

View File

@ -0,0 +1,29 @@
// Type definitions for Apache Cordova Device plugin.
// Project: https://github.com/apache/cordova-plugin-device
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/**
* This plugin defines a global device object, which describes the device's hardware and software.
* Although the object is in the global scope, it is not available until after the deviceready event.
*/
interface Device {
/** Get the version of Cordova running on the device. */
cordova: string;
/**
* The device.model returns the name of the device's model or product. The value is set
* by the device manufacturer and may be different across versions of the same product.
*/
model: string;
/** Get the device's operating system name. */
platform: string;
/** Get the device's Universally Unique Identifier (UUID). */
uuid: string;
/** Get the operating system version. */
version: string;
}
declare var device: Device;

View File

@ -0,0 +1,77 @@
// Type definitions for Apache Cordova Device Motion plugin.
// Project: https://github.com/apache/cordova-plugin-device-motion
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor
* that detects the change (delta) in movement relative to the current device orientation,
* in three dimensions along the x, y, and z axis.
*/
accelerometer: Accelerometer;
}
/**
* This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor
* that detects the change (delta) in movement relative to the current device orientation,
* in three dimensions along the x, y, and z axis.
*/
interface Accelerometer {
/**
* Stop watching the Acceleration referenced by the watchID parameter.
* @param watchID The ID returned by navigator.accelerometer.watchAcceleration.
*/
clearWatch(watchID: WatchHandle): void;
/**
* Get the current acceleration along the x, y, and z axes.
* These acceleration values are returned to the accelerometerSuccess callback function.
* @param accelerometerSuccess Success callback that gets the Acceleration object.
* @param accelerometerError Success callback
*/
getCurrentAcceleration(
accelerometerSuccess: (acceleration: Acceleration) => void,
accelerometerError: () => void): void;
/**
* Retrieves the device's current Acceleration at a regular interval, executing the
* accelerometerSuccess callback function each time. Specify the interval in milliseconds
* via the acceleratorOptions object's frequency parameter.
* The returned watch ID references the accelerometer's watch interval, and can be used
* with navigator.accelerometer.clearWatch to stop watching the accelerometer.
* @param accelerometerSuccess Callback, that called at every time interval and passes an Acceleration object.
* @param accelerometerError Error callback.
* @param accelerometerOptions Object with options for watchAcceleration
*/
watchAcceleration(
accelerometerSuccess: (acceleration: Acceleration) => void,
accelerometerError: () => void,
accelerometerOptions?: AccelerometerOptions): WatchHandle;
}
/**
* Contains Accelerometer data captured at a specific point in time. Acceleration values include
* the effect of gravity (9.81 m/s^2), so that when a device lies flat and facing up, x, y, and z
* values returned should be 0, 0, and 9.81.
*/
interface Acceleration {
/** Amount of acceleration on the x-axis. (in m/s^2) */
x: number;
/** Amount of acceleration on the y-axis. (in m/s^2) */
y: number;
/** Amount of acceleration on the z-axis. (in m/s^2) */
z: number;
/** Creation timestamp in milliseconds. */
timestamp: number;
}
/** Object with options for watchAcceleration */
interface AccelerometerOptions {
/** How often to retrieve the Acceleration in milliseconds. (Default: 10000) */
frequency?: number;
}
/** Abstract type for watch IDs used by Accelerometer. Values of these type are actually `number` at runtime.*/
interface WatchHandle { }

View File

@ -0,0 +1,86 @@
// Type definitions for Apache Cordova Device Orientation plugin.
// Project: https://github.com/apache/cordova-plugin-device-orientation
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides access to the device's compass. The compass is a sensor that detects
* the direction or heading that the device is pointed, typically from the top of the device.
* It measures the heading in degrees from 0 to 359.99, where 0 is north.
*/
compass: Compass;
}
/**
* This plugin provides access to the device's compass. The compass is a sensor that detects
* the direction or heading that the device is pointed, typically from the top of the device.
* It measures the heading in degrees from 0 to 359.99, where 0 is north.
*/
interface Compass {
/**
* Get the current compass heading. The compass heading is returned via a CompassHeading
* object using the onSuccess callback function.
* @param onSuccess Success callback that passes CompassHeading object.
* @param onError Error callback that passes CompassError object.
*/
getCurrentHeading(
onSuccess: (heading: CompassHeading) => void,
onError: (error: CompassError) => void,
options?: CompassOptions): void;
/**
* Gets the device's current heading at a regular interval. Each time the heading is retrieved,
* the headingSuccess callback function is executed. The returned watch ID references the compass
* watch interval. The watch ID can be used with navigator.compass.clearWatch to stop watching
* the navigator.compass.
* @param onSuccess Success callback that passes CompassHeading object.
* @param onError Error callback that passes CompassError object.
* @param options CompassOptions object
*/
watchHeading(
onSuccess: (heading: CompassHeading) => void,
onError: (error: CompassError) => void,
options?: CompassOptions): number;
/**
* Stop watching the compass referenced by the watch ID parameter.
* @param id The ID returned by navigator.compass.watchHeading.
*/
clearWatch(id: number): void;
}
/** A CompassHeading object is returned to the compassSuccess callback function. */
interface CompassHeading {
/** The heading in degrees from 0-359.99 at a single moment in time. */
magneticHeading: number;
/** The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. */
trueHeading: number;
/** The deviation in degrees between the reported heading and the true heading. */
headingAccuracy: number;
/** The time at which this heading was determined. */
timestamp: number;
}
interface CompassOptions {
filter?: number;
frequency?: number;
}
/** A CompassError object is returned to the onError callback function when an error occurs. */
interface CompassError {
/**
* One of the predefined error codes
* CompassError.COMPASS_INTERNAL_ERR
* CompassError.COMPASS_NOT_SUPPORTED
*/
code: number;
}
declare var CompassError: {
/** Constructor for CompassError object */
new(code: number): CompassError;
COMPASS_INTERNAL_ERR: number;
COMPASS_NOT_SUPPORTED: number
}

View File

@ -0,0 +1,69 @@
// Type definitions for Apache Cordova Dialogs plugin.
// Project: https://github.com/apache/cordova-plugin-dialogs
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** This plugin provides access to some native dialog UI elements. */
notification: Notification
}
/** This plugin provides access to some native dialog UI elements. */
interface Notification {
/**
* Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature,
* but some platforms use the browser's alert function, which is typically less customizable.
* @param message Dialog message.
* @param alertCallback Callback to invoke when alert dialog is dismissed.
* @param title Dialog title, defaults to 'Alert'.
* @param buttonName Button name, defaults to OK.
*/
alert(message: string,
alertCallback: () => void,
title?: string,
buttonName?: string): void;
/**
* The device plays a beep sound.
* @param times The number of times to repeat the beep.
*/
beep(times: number): void;
/**
* Displays a customizable confirmation dialog box.
* @param message Dialog message.
* @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3)
* or when the dialog is dismissed without a button press (0).
* @param title Dialog title, defaults to Confirm.
* @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel].
*/
confirm(message: string,
confirmCallback: (choice: number) => void,
title?: string,
buttonLabels?: string[]): void;
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param message Dialog message.
* @param promptCallback Callback to invoke when a button is pressed.
* @param title Dialog title, defaults to "Prompt".
* @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"].
* @param defaultText Default textbox input value, default: "".
*/
prompt(message: string,
promptCallback: (result: NotificationPromptResult) => void,
title?: string,
buttonLabels?: string[],
defaultText?: string): void;
}
/** Object, passed to promptCallback */
interface NotificationPromptResult {
/**
* The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
* 0 is the result when the dialog is dismissed without a button press.
*/
buttonIndex: number;
/** The text entered in the prompt dialog box. */
input1: string;
}

View File

@ -0,0 +1,364 @@
// Type definitions for Apache Cordova File System plugin.
// Project: https://github.com/apache/cordova-plugin-file
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
/**
* Requests a filesystem in which to store application data.
* @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT.
* @param size This is an indicator of how much storage space, in bytes, the application expects to need.
* @param successCallback The callback that is called when the user agent provides a filesystem.
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
*/
requestFileSystem(
type: number,
size: number,
successCallback: (fileSystem: FileSystem) => void,
errorCallback?: (fileError: FileError) => void): void;
/**
* Look up file system Entry referred to by local URI.
* @param string uri URI referring to a local file or directory
* @param successCallback invoked with Entry object corresponding to URI
* @param errorCallback invoked if error occurs retrieving file system entry
*/
resolveLocalFileSystemURI(uri: string,
successCallback: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
TEMPORARY: number;
PERSISTENT: number;
}
/** This interface represents a file system. */
interface FileSystem {
/* The name of the file system, unique across the list of exposed file systems. */
name: string;
/** The root directory of the file system. */
root: DirectoryEntry;
}
/**
* An abstract interface representing entries in a file system,
* each of which may be a File or DirectoryEntry.
*/
interface Entry {
/** Entry is a file. */
isFile: boolean;
/** Entry is a directory. */
isDirectory: boolean;
/** The name of the entry, excluding the path leading to it. */
name: string;
/** The full absolute path from the root to the entry. */
fullPath: string;
/** The file system on which the entry resides. */
fileSystem: FileSystem;
nativeURL: string;
/**
* Look up metadata about this entry.
* @param successCallback A callback that is called with the time of the last modification.
* @param errorCallback A callback that is called when errors happen.
*/
getMetadata(
successCallback: (metadata: Metadata) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Move an entry to a different location on the file system. It is an error to try to:
* move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided;
* move a file to a path occupied by a directory;
* move a directory to a path occupied by a file;
* move any element to a path occupied by a directory which is not empty.
* A move of a file on top of an existing file must attempt to delete and replace that file.
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
* @param parent The directory to which to move the entry.
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
* @param successCallback A callback that is called with the Entry for the new location.
* @param errorCallback A callback that is called when errors happen.
*/
moveTo(parent: DirectoryEntry,
newName?: string,
successCallback?: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Copy an entry to a different location on the file system. It is an error to try to:
* copy a directory inside itself or to any child at any depth;
* copy an entry into its parent if a name different from its current one isn't provided;
* copy a file to a path occupied by a directory;
* copy a directory to a path occupied by a file;
* copy any element to a path occupied by a directory which is not empty.
* A copy of a file on top of an existing file must attempt to delete and replace that file.
* A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.
* Directory copies are always recursive--that is, they copy all contents of the directory.
* @param parent The directory to which to move the entry.
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
* @param successCallback A callback that is called with the Entry for the new object.
* @param errorCallback A callback that is called when errors happen.
*/
copyTo(parent: DirectoryEntry,
newName?: string,
successCallback?: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Returns a URL that can be used as the src attribute of a <video> or <audio> tag.
* If that is not possible, construct a cdvfile:// URL.
* @return string URL
*/
toURL(): string;
/**
* Return a URL that can be passed across the bridge to identify this entry.
* @return string URL that can be passed across the bridge to identify this entry
*/
toInternalURL(): string;
/**
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
* @param successCallback A callback that is called on success.
* @param errorCallback A callback that is called when errors happen.
*/
remove(successCallback: () => void,
errorCallback?: (error: FileError) => void): void;
/**
* Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.
* @param successCallback A callback that is called with the time of the last modification.
* @param errorCallback A callback that is called when errors happen.
*/
getParent(successCallback: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
}
/** This interface supplies information about the state of a file or directory. */
interface Metadata {
/** This is the time at which the file or directory was last modified. */
modificationTime: Date;
/** The size of the file, in bytes. This must return 0 for directories. */
size: number;
}
/** This interface represents a directory on a file system. */
interface DirectoryEntry extends Entry {
/**
* Creates a new DirectoryReader to read Entries from this Directory.
*/
createReader(): DirectoryReader;
/**
* Creates or looks up a file.
* @param path Either an absolute path or a relative path from this DirectoryEntry
* to the file to be looked up or created.
* It is an error to attempt to create a file whose immediate parent does not yet exist.
* @param options If create and exclusive are both true, and the path already exists, getFile must fail.
* If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.
* If create is not true and the path doesn't exist, getFile must fail.
* If create is not true and the path exists, but is a directory, getFile must fail.
* Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
* @param successCallback A callback that is called to return the File selected or created.
* @param errorCallback A callback that is called when errors happen.
*/
getFile(path: string, options?: Flags,
successCallback?: (entry: FileEntry) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Creates or looks up a directory.
* @param path Either an absolute path or a relative path from this DirectoryEntry
* to the directory to be looked up or created.
* It is an error to attempt to create a directory whose immediate parent does not yet exist.
* @param options If create and exclusive are both true and the path already exists, getDirectory must fail.
* If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.
* If create is not true and the path doesn't exist, getDirectory must fail.
* If create is not true and the path exists, but is a file, getDirectory must fail.
* Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
* @param successCallback A callback that is called to return the Directory selected or created.
* @param errorCallback A callback that is called when errors happen.
*/
getDirectory(path: string, options?: Flags,
successCallback?: (entry: DirectoryEntry) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Deletes a directory and all of its contents, if any. In the event of an error (e.g. trying
* to delete a directory that contains a file that cannot be removed), some of the contents
* of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
* @param successCallback A callback that is called on success.
* @param errorCallback A callback that is called when errors happen.
*/
removeRecursively(successCallback: () => void,
errorCallback?: (error: FileError) => void): void;
}
/**
* This dictionary is used to supply arguments to methods
* that look up or create files or directories.
*/
interface Flags {
/** Used to indicate that the user wants to create a file or directory if it was not previously there. */
create?: boolean;
/** By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists. */
exclusive?: boolean;
}
/**
* This interface lets a user list files and directories in a directory. If there are
* no additions to or deletions from a directory between the first and last call to
* readEntries, and no errors occur, then:
* A series of calls to readEntries must return each entry in the directory exactly once.
* Once all entries have been returned, the next call to readEntries must produce an empty array.
* If not all entries have been returned, the array produced by readEntries must not be empty.
* The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
*/
interface DirectoryReader {
/**
* Read the next block of entries from this directory.
* @param successCallback Called once per successful call to readEntries to deliver the next
* previously-unreported set of Entries in the associated Directory.
* If all Entries have already been returned from previous invocations
* of readEntries, successCallback must be called with a zero-length array as an argument.
* @param errorCallback A callback indicating that there was an error reading from the Directory.
*/
readEntries(
successCallback: (entries: Entry[]) => void,
errorCallback?: (error: FileError) => void): void;
}
/** This interface represents a file on a file system. */
interface FileEntry extends Entry {
/**
* Creates a new FileWriter associated with the file that this FileEntry represents.
* @param successCallback A callback that is called with the new FileWriter.
* @param errorCallback A callback that is called when errors happen.
*/
createWriter(successCallback: (
writer: FileWriter) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Returns a File that represents the current state of the file that this FileEntry represents.
* @param successCallback A callback that is called with the File.
* @param errorCallback A callback that is called when errors happen.
*/
file(successCallback: (file: File) => void,
errorCallback?: (error: FileError) => void): void;
}
/**
* This interface provides methods to monitor the asynchronous writing of blobs
* to disk using progress events and event handler attributes.
*/
interface FileSaver extends EventTarget {
/** Terminate file operation */
abort(): void;
/**
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting,
* must return the current state, which must be one of the following values:
* INIT
* WRITING
* DONE
*/
readyState: number;
/** Handler for writestart events. */
onwritestart: (event: ProgressEvent) => void;
/** Handler for progress events. */
onprogress: (event: ProgressEvent) => void;
/** Handler for write events. */
onwrite: (event: ProgressEvent) => void;
/** Handler for abort events. */
onabort: (event: ProgressEvent) => void;
/** Handler for error events. */
onerror: (event: ProgressEvent) => void;
/** Handler for writeend events. */
onwriteend: (event: ProgressEvent) => void;
/** The last error that occurred on the FileSaver. */
error: Error;
}
/**
* This interface expands on the FileSaver interface to allow for multiple write
* actions, rather than just saving a single Blob.
*/
interface FileWriter extends FileSaver {
/**
* The byte offset at which the next write to the file will occur. This always less or equal than length.
* A newly-created FileWriter will have position set to 0.
*/
position: number;
/**
* The length of the file. If the user does not have read access to the file,
* this will be the highest byte offset at which the user has written.
*/
length: number;
/**
* Write the supplied data to the file at position.
* @param {Blob} data The blob to write.
*/
write(data: Blob): void;
/**
* The file position at which the next write will occur.
* @param offset If nonnegative, an absolute byte offset into the file.
* If negative, an offset back from the end of the file.
*/
seek(offset: number): void;
/**
* Changes the length of the file to that specified. If shortening the file, data beyond the new length
* will be discarded. If extending the file, the existing data will be zero-padded up to the new length.
* @param size The size to which the length of the file is to be adjusted, measured in bytes.
*/
truncate(size: number): void;
}
/* FileWriter states */
declare var FileWriter: {
INIT: number;
WRITING: number;
DONE: number
};
interface FileError {
/** Error code */
code: number;
}
declare var FileError: {
new (code: number): FileError;
NOT_FOUND_ERR: number;
SECURITY_ERR: number;
ABORT_ERR: number;
NOT_READABLE_ERR: number;
ENCODING_ERR: number;
NO_MODIFICATION_ALLOWED_ERR: number;
INVALID_STATE_ERR: number;
SYNTAX_ERR: number;
INVALID_MODIFICATION_ERR: number;
QUOTA_EXCEEDED_ERR: number;
TYPE_MISMATCH_ERR: number;
PATH_EXISTS_ERR: number;
};
/*
* Constants defined in fileSystemPaths
*/
interface Cordova {
file: {
/* Read-only directory where the application is installed. */
applicationDirectory: string;
/* Root of app's private writable storage */
applicationStorageDirectory: string;
/* Where to put app-specific data files. */
dataDirectory: string;
/* Cached files that should survive app restarts. Apps should not rely on the OS to delete files in here. */
cacheDirectory: string;
/* Android: the application space on external storage. */
externalApplicationStorageDirectory: string;
/* Android: Where to put app-specific data files on external storage. */
externalDataDirectory: string;
/* Android: the application cache on external storage. */
externalCacheDirectory: string;
/* Android: the external storage (SD card) root. */
externalRootDirectory: string;
/* iOS: Temp directory that the OS can clear at will. */
tempDirectory: string;
/* iOS: Holds app-specific files that should be synced (e.g. to iCloud). */
syncedDataDirectory: string;
/* iOS: Files private to the app, but that are meaningful to other applciations (e.g. Office files) */
documentsDirectory: string;
/* BlackBerry10: Files globally available to all apps */
sharedDirectory: string
}
}

View File

@ -0,0 +1,136 @@
// Type definitions for Apache Cordova FileTransfer plugin.
// Project: https://github.com/apache/cordova-plugin-file-transfer
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/// <reference path="FileSystem.d.ts"/>
/**
* The FileTransfer object provides a way to upload files using an HTTP multi-part POST request,
* and to download files as well.
*/
interface FileTransfer {
/** Called with a ProgressEvent whenever a new chunk of data is transferred. */
onprogress: (event: ProgressEvent) => void;
/**
* Sends a file to a server.
* @param fileURL Filesystem URL representing the file on the device. For backwards compatibility,
* this can also be the full path of the file on the device.
* @param server URL of the server to receive the file, as encoded by encodeURI().
* @param successCallback A callback that is passed a FileUploadResult object.
* @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
* Invoked with a FileTransferError object.
* @param options Optional parameters.
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
* This is useful since Android rejects self-signed security certificates.
* Not recommended for production use. Supported on Android and iOS.
*/
upload(
fileURL: string,
server: string,
successCallback: (result: FileUploadResult) => void,
errorCallback: (error: FileTransferError) => void,
options?: FileUploadOptions,
trustAllHosts?: boolean): void;
/**
* downloads a file from server.
* @param source URL of the server to download the file, as encoded by encodeURI().
* @param target Filesystem url representing the file on the device. For backwards compatibility,
* this can also be the full path of the file on the device.
* @param successCallback A callback that is passed a FileEntry object. (Function)
* @param errorCallback A callback that executes if an error occurs when retrieving the fileEntry.
* Invoked with a FileTransferError object.
* @param options Optional parameters.
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
* This is useful since Android rejects self-signed security certificates.
* Not recommended for production use. Supported on Android and iOS.
*/
download(
source: string,
target: string,
successCallback: (fileEntry: FileEntry) => void,
errorCallback: (error: FileTransferError) => void,
options?: FileDownloadOptions,
trustAllHosts?: boolean): void;
/**
* Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object
* which has an error code of FileTransferError.ABORT_ERR.
*/
abort(): void;
}
declare var FileTransfer: {
new (): FileTransfer;
};
/** A FileUploadResult object is passed to the success callback of the FileTransfer object's upload() method. */
interface FileUploadResult {
/** The number of bytes sent to the server as part of the upload. */
bytesSent: number;
/** The HTTP response code returned by the server. */
responseCode: number;
/** The HTTP response returned by the server. */
response: string;
/** The HTTP response headers by the server. Currently supported on iOS only.*/
headers: any;
}
/** Optional parameters for upload method. */
interface FileUploadOptions {
/** The name of the form element. Defaults to file. */
fileKey?: string;
/** The file name to use when saving the file on the server. Defaults to image.jpg. */
fileName?: string;
/** The 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. Use an array to specify more than one value. */
headers?: Object[];
}
/** A FileTransferError object is passed to an error callback when an error occurs. */
interface FileTransferError {
/**
* One of the predefined error codes listed below.
* FileTransferError.FILE_NOT_FOUND_ERR
* FileTransferError.INVALID_URL_ERR
* FileTransferError.CONNECTION_ERR
* FileTransferError.ABORT_ERR
* 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;
}

View File

@ -0,0 +1,255 @@
// Type definitions for Apache Cordova Globalization plugin.
// Project: https://github.com/apache/cordova-plugin-globalization
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** This plugin obtains information and performs operations specific to the user's locale and timezone. */
globalization: Globalization
}
/** This plugin obtains information and performs operations specific to the user's locale and timezone. */
interface Globalization {
/**
* Get the string identifier for the client's current language.
* @param onSuccess Called on success getting the language with a properties object,
* that should have a value property with a String value.
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
*/
getPreferredLanguage(
onSuccess: (language: { value: string; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Get the string identifier for the client's current locale setting.
* @param onSuccess Called on success getting the locale identifier with a properties object,
* that should have a value property with a String value.
* @param onError Called on error getting the locale identifier with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN\_ERROR.
*/
getLocaleName(
onSuccess: (locale: { value: string; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Returns a date formatted as a string according to the client's locale and timezone.
* @param date Date to format.
* @param onSuccess Called on success with a properties object,
* that should have a value property with a String value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'}
*/
dateToString(
date: Date,
onSuccess: (date: { value: string; }) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Parses a date formatted as a string, according to the client's user preferences
* and calendar using the time zone of the client, and returns the corresponding date object.
* @param dateString String to parse
* @param onSuccess Called on success with GlobalizationDate object
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.PARSING_ERROR.
* @param options Optional parse parameters. Default {formatLength:'short', selector:'date and time'}
*/
stringToDate(
dateString: string,
onSuccess: (date: GlobalizationDate) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Returns a pattern string to format and parse dates according to the client's user preferences.
* @param onSuccess Called on success getting pattern with a GlobalizationDatePattern object
* @param onError Called on error getting pattern with a GlobalizationError object.
* The error's expected code is GlobalizationError.PATTERN_ERROR.
* @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'}
*/
getDatePattern(
onSuccess: (datePattern: GlobalizationDatePattern) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
* @param onSuccess Called on success getting names with a properties object,
* that should have a value property with a String[] value.
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
* @param options Optional parameters. Default: {type:'wide', item:'months'}
*/
getDateNames(
onSuccess: (names: { value: string[]; }) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
* @param {Date} date Date to check
* @param onSuccess Called on success with a properties object,
* that should have a dst property with a boolean value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
*/
isDaylightSavingsTime(
date: Date,
onSuccess: (result: { dst: boolean; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Returns the first day of the week according to the client's user preferences and calendar.
* @param onSuccess Called on success with a day object,
* that should have a value property with a number value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
*/
getFirstDayOfWeek(
onSuccess: (day: { value: number; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Returns a number formatted as a string according to the client's user preferences.
* @param value Number to format
* @param onSuccess Called on success with a result object,
* that should have a value property with a String value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param format Optional format parameters. Default: {type:'decimal'}
*/
nubmerToString(
value: number,
onSuccess: (result: { value: string; }) => void,
onError: (error: GlobalizationError) => void,
format?: { type?: string; }): void;
/**
* Parses a number formatted as a string according to the client's user preferences and returns the corresponding number.
* @param value String to parse
* @param onSuccess Called on success with a result object,
* that should have a value property with a number value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param format Optional format parameters. Default: {type:'decimal'}
*/
stringToNumber(
value: string,
onSuccess: (result: { value: number; }) => void,
onError: (error: GlobalizationError) => void,
format?: { type?: string; }): void;
/**
* Returns a pattern string to format and parse numbers according to the client's user preferences.
* @param onSuccess Called on success getting pattern with a GlobalizationNumberPattern object
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.PATTERN_ERROR.
* @param options Optional format parameters. Default {type:'decimal'}.
*/
getNumberPattern(
onSuccess: (result: GlobalizationNumberPattern) => void,
onError: (error: GlobalizationError) => void,
format?: { type?: string; }): void;
/**
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
* @param currencyCode Should be a String of one of the ISO 4217 currency codes, for example 'USD'.
* @param onSuccess Called on success getting pattern with a GlobalizatioCurrencyPattern object
* @param onError Called on error getting pattern with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param options Optional format parameters. Default {type:'decimal'}.
*/
getCurrencyPattern(
currencyCode: string,
onSuccess: (result: GlobalizationCurrencyPattern) => void,
onError: (error: GlobalizationError) => void): void;
}
/** Date returned by stringToDate */
interface GlobalizationDate {
/* The four digit year. */
year: number;
/* The month from (0-11). */
month: number;
/* The day from (1-31). */
day: number;
/* The hour from (0-23). */
hour: number;
/* The minute from (0-59). */
minute: number;
/* The second from (0-59). */
second: number;
/* The milliseconds (from 0-999), not available on all platforms. */
millisecond: number;
}
/** Pattern to format and parse dates according to the client's user preferences.*/
interface GlobalizationDatePattern {
/* The date and time pattern to format and parse dates. The patterns follow Unicode Technical Standard #35. */
pattern: string;
/* The abbreviated name of the time zone on the client. */
timezone: string;
/* The current difference in seconds between the client's time zone and coordinated universal time. */
utc_offset: number;
/* The current daylight saving time offset in seconds between the client's non-daylight saving's time zone and the client's daylight saving's time zone. */
dst_offset: number;
}
interface GlobalizationDateNameOptions {
type?: string;
item?: string;
}
/** Pattern to format and parse numbers according to the client's user preferences. */
interface GlobalizationNumberPattern {
/* The number pattern to format and parse numbers. The patterns follow Unicode Technical Standard #35. */
pattern: string;
/* The symbol to use when formatting and parsing, such as a percent or currency symbol. */
symbol: string;
/* The number of fractional digits to use when parsing and formatting numbers. */
fraction: number;
/* The rounding increment to use when parsing and formatting. */
rounding: number;
/* The symbol to use for positive numbers when parsing and formatting. */
positive: string;
/* The symbol to use for negative numbers when parsing and formatting. */
negative: string;
/* The decimal symbol to use for parsing and formatting. */
decimal: string;
/* The grouping symbol to use for parsing and formatting. */
grouping: string;
}
/**
* Pattern to format and parse currency values according
* to the client's user preferences and ISO 4217 currency code.
*/
interface GlobalizationCurrencyPattern {
/** The currency pattern to format and parse currency values. The patterns follow Unicode Technical Standard #35. */
pattern: string;
/** The ISO 4217 currency code for the pattern. */
code: string;
/** The number of fractional digits to use when parsing and formatting currency. */
fraction: number;
/** The rounding increment to use when parsing and formatting. */
rounding: number;
/** The decimal symbol to use for parsing and formatting. */
decimal: string;
/** The grouping symbol to use for parsing and formatting. */
grouping: string;
}
/** An object representing a error from the Globalization API. */
interface GlobalizationError {
/** One of the following codes representing the error type:
* GlobalizationError.UNKNOWN_ERROR: 0
* GlobalizationError.FORMATTING_ERROR: 1
* GlobalizationError.PARSING_ERROR: 2
* GlobalizationError.PATTERN_ERROR: 3
*/
code: number;
/** A text message that includes the error's explanation and/or details */
message: string;
}
/** An object representing a error from the Globalization API. */
declare var GlobalizationError: {
UNKNOWN_ERROR: number;
FORMATTING_ERROR: number;
PARSING_ERROR: number;
PATTERN_ERROR: number;
}

View File

@ -0,0 +1,219 @@
// Type definitions for Apache Cordova InAppBrowser plugin.
// Project: https://github.com/apache/cordova-plugin-inappbrowser
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_self", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_blank", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_system", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: string, options?: string, replace?: boolean): InAppBrowser;
}
/**
* The object returned from a call to window.open.
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface InAppBrowser extends Window {
onloadstart: (type: InAppBrowserEvent) => void;
onloadstop: (type: InAppBrowserEvent) => void;
onloaderror: (type: InAppBrowserEvent) => void;
onexit: (type: InAppBrowserEvent) => void;
// addEventListener overloads
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an Event object as a parameter.
*/
addEventListener(type: string, callback: (event: Event) => void): void;
// removeEventListener overloads
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an Event object as a parameter.
*/
removeEventListener(type: string, callback: (event: Event) => void): void;
/** Closes the InAppBrowser window. */
close(): void;
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
show(): void;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { code: string }, callback: (result: any) => void): void;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { file: string }, callback: (result: any) => void): void;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { code: string }, callback: () => void): void;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { file: string }, callback: () => void): void;
}
interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
type: string;
/** the URL that was loaded. */
url: string;
/** the error code, only in the case of loaderror. */
code: number;
/** the error message, only in the case of loaderror. */
message: string;
}

View File

@ -0,0 +1,73 @@
// Type definitions for Apache Cordova Media plugin.
// Project: https://github.com/apache/cordova-plugin-media
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
declare var Media: {
new (
src: string,
mediaSuccess: () => void,
mediaError?: (error: MediaError) => any,
mediaStatus?: (status: number) => void): Media;
//Media statuses
MEDIA_NONE: number;
MEDIA_STARTING: number;
MEDIA_RUNNING: number;
MEDIA_PAUSED: number;
MEDIA_STOPPED: number
};
/**
* This plugin provides the ability to record and play back audio files on a device.
* NOTE: The current implementation does not adhere to a W3C specification for media capture,
* and is provided for convenience only. A future implementation will adhere to the latest
* W3C specification and may deprecate the current APIs.
*/
interface Media {
/**
* Returns the current position within an audio file. Also updates the Media object's position parameter.
* @param mediaSuccess The callback that is passed the current position in seconds.
* @param mediaError The callback to execute if an error occurs.
*/
getCurrentPosition(
mediaSuccess: (position: number) => void,
mediaError?: (error: MediaError) => void): void;
/** Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. */
getDuration(): number;
/** Starts or resumes playing an audio file. */
play(): void;
/** Pauses playing an audio file. */
pause(): void;
/**
* Releases the underlying operating system's audio resources. This is particularly important
* for Android, since there are a finite amount of OpenCore instances for media playback.
* Applications should call the release function for any Media resource that is no longer needed.
*/
release(): void;
/**
* Sets the current position within an audio file.
* @param position Position in milliseconds.
*/
seekTo(position: number): void;
/**
* Set the volume for an audio file.
* @param volume The volume to set for playback. The value must be within the range of 0.0 to 1.0.
*/
setVolume(volume: number): void;
/** Starts recording an audio file. */
startRecord(): void;
/** Stops recording an audio file. */
stopRecord(): void;
/** Stops playing an audio file. */
stop(): void;
/**
* The position within the audio playback, in seconds.
* Not automatically updated during play; call getCurrentPosition to update.
*/
position: number;
/** The duration of the media, in seconds. */
duration: number;
}

View File

@ -0,0 +1,167 @@
// Type definitions for Apache Cordova MediaCapture plugin.
// Project: https://github.com/apache/cordova-plugin-media-capture
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
device: Device;
}
interface Device {
capture: Capture;
}
/** This plugin provides access to the device's audio, image, and video capture capabilities. */
interface Capture {
/**
* Start the audio recorder application and return information about captured audio clip files.
* @param onSuccess Executes when the capture operation finishes with an array
* of MediaFile objects describing each captured audio clip file.
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
* @param options Encapsulates audio capture configuration options.
*/
captureAudio(
onSuccess: (mediaFiles: MediaFile[]) => void,
onError: (error: CaptureError) => void,
options?: AudioOptions): void ;
/**
* Start the camera application and return information about captured image files.
* @param onSuccess Executes when the capture operation finishes with an array
* of MediaFile objects describing each captured image clip file.
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
* @param options Encapsulates audio capture configuration options.
*/
captureImage(
onSuccess: (mediaFiles: MediaFile[]) => void,
onError: (error: CaptureError) => void,
options?: ImageOptions): void ;
/**
* Start the video recorder application and return information about captured video clip files.
* @param onSuccess Executes when the capture operation finishes with an array
* of MediaFile objects describing each captured video clip file.
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
* @param options Encapsulates audio capture configuration options.
*/
captureVideo(
onSuccess: (mediaFiles: MediaFile[]) => void,
onError: (error: CaptureError) => void,
options?: VideoOptions): void ;
/** The audio recording formats supported by the device. */
supportedAudioModes: ConfigurationData[];
/** The recording image sizes and formats supported by the device. */
supportedImageModes: ConfigurationData[];
/** The recording video resolutions and formats supported by the device. */
supportedVideoModes: ConfigurationData[];
}
/** Encapsulates properties of a media capture file. */
interface MediaFile {
/** The name of the file, without path information. */
name: string;
/** The full path of the file, including the name. */
fullPath: string;
/** The file's mime type */
type: string;
/** The date and time when the file was last modified. */
lastModifiedDate: Date;
/** The size of the file, in bytes. */
size: number;
/**
* Retrieves format information about the media capture file.
* @param successCallback Invoked with a MediaFileData object when successful.
* @param errorCallback Invoked if the attempt fails, this function.
*/
getFormatData(
successCallback: (data: MediaFileData) => void,
errorCallback?: () => void): void;
}
/** Encapsulates format information about a media file. */
interface MediaFileData {
/** The actual format of the audio and video content. */
codecs: string;
/** The average bitrate of the content. The value is zero for images. */
bitrate: number;
/** The height of the image or video in pixels. The value is zero for audio clips. */
height: number;
/** The width of the image or video in pixels. The value is zero for audio clips. */
width: number;
/** The length of the video or sound clip in seconds. The value is zero for images. */
duration: number;
}
/** Encapsulates the error code resulting from a failed media capture operation. */
interface CaptureError {
/**
* One of the pre-defined error codes listed below.
* CaptureError.CAPTURE_INTERNAL_ERR
* The camera or microphone failed to capture image or sound.
* CaptureError.CAPTURE_APPLICATION_BUSY
* The camera or audio capture application is currently serving another capture request.
* CaptureError.CAPTURE_INVALID_ARGUMENT
* Invalid use of the API (e.g., the value of limit is less than one).
* CaptureError.CAPTURE_NO_MEDIA_FILES
* The user exits the camera or audio capture application before capturing anything.
* CaptureError.CAPTURE_NOT_SUPPORTED
* The requested capture operation is not supported.
*/
code: number;
message: string;
}
declare var CaptureError: {
/** Constructor for CaptureError */
new (code: number, message: string): CaptureError;
CAPTURE_INTERNAL_ERR: number;
CAPTURE_APPLICATION_BUSY: number;
CAPTURE_INVALID_ARGUMENT: number;
CAPTURE_NO_MEDIA_FILES: number;
CAPTURE_NOT_SUPPORTED: number;
}
/** Encapsulates audio capture configuration options. */
interface AudioOptions {
/**
* The maximum number of audio clips the device's user can capture in a single
* capture operation. The value must be greater than or equal to 1.
*/
limit?: number;
/** The maximum duration of a audio clip, in seconds. */
duration?: number;
}
/** Encapsulates image capture configuration options. */
interface ImageOptions {
/**
* The maximum number of images the user can capture in a single capture operation.
* The value must be greater than or equal to 1 (defaults to 1).
*/
limit?: number;
}
/** Encapsulates video capture configuration options. */
interface VideoOptions {
/**
* The maximum number of video clips the device's user can capture in a single
* capture operation. The value must be greater than or equal to 1.
*/
limit?: number;
/** The maximum duration of a video clip, in seconds. */
duration?: number;
}
/** Encapsulates a set of media capture parameters that a device supports. */
interface ConfigurationData {
/** The ASCII-encoded lowercase string representing the media type. */
type: string;
/** The height of the image or video in pixels. The value is zero for sound clips. */
height: number;
/** The width of the image or video in pixels. The value is zero for sound clips. */
width: number;
}

View File

@ -0,0 +1,60 @@
// Type definitions for Apache Cordova Network Information plugin.
// Project: https://github.com/apache/cordova-plugin-network-information
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides an implementation of an old version of the Network Information API.
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
*/
connection: Connection;
// see https://github.com/apache/cordova-plugin-network-information/blob/dev/doc/index.md#api-change
// for
network: {
/**
* This plugin provides an implementation of an old version of the Network Information API.
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
*/
connection: Connection
}
}
interface Document {
addEventListener(type: "online", connectionStateCallback: () => any, useCapture?: boolean): void;
addEventListener(type: "offline", connectionStateCallback: () => any, useCapture?: boolean): void;
}
/**
* The connection object, exposed via navigator.connection, provides information
* about the device's cellular and wifi connection.
*/
interface Connection {
/**
* This property offers a fast way to determine the device's network connection state, and type of connection.
* One of:
* Connection.UNKNOWN
* Connection.ETHERNET
* Connection.WIFI
* Connection.CELL_2G
* Connection.CELL_3G
* Connection.CELL_4G
* Connection.CELL
* Connection.NONE
*/
type: number
}
declare var Connection: {
UNKNOWN: number;
ETHERNET: number;
WIFI: number;
CELL_2G: number;
CELL_3G: number;
CELL_4G: number;
CELL: number;
NONE: number;
}

View File

@ -0,0 +1,70 @@
// Type definitions for Apache Cordova Push plugin.
// Project: https://github.com/phonegap-build/PushPlugin
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
plugins: Plugins
}
interface Plugins {
/**
* This plugin allows to receive push notifications. The Android implementation uses
* Google's GCM (Google Cloud Messaging) service,
* whereas the iOS version is based on Apple APNS Notifications
*/
pushNotification: PushNotification
}
/**
* This plugin allows to receive push notifications. The Android implementation uses
* Google's GCM (Google Cloud Messaging) service,
* whereas the iOS version is based on Apple APNS Notifications
*/
interface PushNotification {
/**
* Registers as push notification receiver.
* @param successCallback Called when a plugin method returns without error.
* @param errorCallback Called when the plugin returns an error.
* @param registrationOptions Options for registration process.
*/
register(
successCallback: (registrationId: string) => void,
errorCallback: (error: any) => void,
registrationOptions: RegistrationOptions): void;
/**
* Unregisters as push notification receiver.
* @param successCallback Called when a plugin method returns without error.
* @param errorCallback Called when the plugin returns an error.
*/
unregister(
successCallback: (result: any) => void,
errorCallback: (error: any) => void): void;
/**
* Sets the badge count visible when the app is not running. iOS only.
* @param successCallback Called when a plugin method returns without error.
* @param errorCallback Called when the plugin returns an error.
* @param badgeCount An integer indicating what number should show up in the badge. Passing 0 will clear the badge.
*/
setApplicationIconBadgeNumber(
successCallback: (result: any) => void,
errorCallback: (error: any) => void,
badgeCount: number): void;
}
/** Options for registration process. */
interface RegistrationOptions {
/** This is the Google project ID you need to obtain by registering your application for GCM. Android only */
senderID?: string;
/** WP8 only */
channelName?: string;
/** Callback, that is fired when notification arrived */
ecb?: string;
badge?: boolean;
sound?: boolean;
alert?: boolean
}

View File

@ -0,0 +1,17 @@
// Type definitions for Apache Cordova Splashscreen plugin.
// Project: https://github.com/apache/cordova-plugin-splashscreen
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** This plugin displays and hides a splash screen during application launch. */
splashscreen: {
/** Dismiss the splash screen. */
hide(): void;
/** Displays the splash screen. */
show(): void;
}
}

View File

@ -0,0 +1,75 @@
// 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/borisyankov/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;
}

View File

@ -0,0 +1,28 @@
// Type definitions for Apache Cordova Vibration plugin.
// Project: https://github.com/apache/cordova-plugin-vibration
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Notification {
/**
* Vibrates the device for the specified amount of time.
* @param time Milliseconds to vibrate the device. Ignored on iOS.
*/
vibrate(time: number): void
/**
* Vibrates the device with a given pattern.
* @param number[] pattern Pattern with which to vibrate the device.
* The first value - number of milliseconds to wait before turning the vibrator on.
* The next value - the number of milliseconds for which to keep the vibrator on before turning it off.
* @param number repeat Optional index into the pattern array at which to start repeating (will repeat until canceled),
* or -1 for no repetition (default).
*/
vibrateWithPattern(pattern: number[], repeat: number): void;
/**
* Immediately cancels any currently running vibration.
*/
cancelVibration(): void;
}

View File

@ -0,0 +1,103 @@
// Type definitions for Apache Cordova WebSQL plugin.
// Project: https://github.com/MSOpenTech/cordova-plugin-websql
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
/**
* Creates (opens, if exist) database with supplied parameters.
* @param name Database name
* @param version Database version
* @param displayname Database display name
* @param size Size, in bytes
* @param creationCallback Callback, that executed on database creation. Accepts Database object.
*/
openDatabase(name: string,
version: string,
displayname: string,
size: number,
creationCallback?: (database: Database) => void): Database;
}
interface Database {
/**
* Starts new transaction.
* @param callback Function, that will be called when transaction starts.
* @param errorCallback Called, when Transaction fails.
* @param successCallback Called, when transaction committed.
*/
transaction(callback: (transaction: SqlTransaction) => void,
errorCallback?: (error: SqlError) => void,
successCallback?: () => void): void;
/**
* Starts new transaction.
* @param callback Function, that will be called when transaction starts.
* @param errorCallback Called, when Transaction fails.
* @param successCallback Called, when transaction committed.
*/
readTransaction(callback: (transaction: SqlTransaction) => void,
errorCallback?: (error: SqlError) => void,
successCallback?: () => void): void;
name: string;
version: string;
displayName: string;
size: number;
}
declare var Database: {
/** Constructor for Database object */
new(name: string,
version: string,
displayname: string,
size: number,
creationCallback: (database: Database)=> void): Database;
};
interface SqlTransaction {
/**
* Executes SQL statement via current transaction.
* @param sql SQL statement to execute.
* @param arguments SQL stetement arguments.
* @param successCallback Called in case of query has been successfully done.
* @param errorCallback Called, when query fails. Return false to continue transaction; true or no return to rollback.
*/
executeSql(sql: string,
arguments?: any[],
successCallback?: (transaction: SqlTransaction, resultSet: SqlResultSet) => void,
errorCallback?: (transaction: SqlTransaction, error: SqlError) => any): void;
}
declare var SqlTransaction: {
new(): SqlTransaction;
};
interface SqlResultSet {
insertId: number;
rowsAffected: number;
rows: SqlResultSetRowList;
}
interface SqlResultSetRowList {
length: number;
item(index: number): Object;
}
interface SqlError {
code: number;
message: string;
}
declare var SqlError: {
// Error code constants from http://www.w3.org/TR/webdatabase/#sqlerror
UNKNOWN_ERR: number;
DATABASE_ERR: number;
VERSION_ERR: number;
TOO_LARGE_ERR: number;
QUOTA_ERR: number;
SYNTAX_ERR: number;
CONSTRAINT_ERR: number;
TIMEOUT_ERR: number;
};

36
www/scripts/appBundle.js Normal file
View File

@ -0,0 +1,36 @@
// Pour obtenir une présentation du modèle Vide, consultez la documentation suivante :
// http://go.microsoft.com/fwlink/?LinkID=397705
// Pour déboguer du code durant le chargement d'une page dans Ripple ou sur les appareils/émulateurs Android, lancez votre application, définissez des points d'arrêt,
// puis exécutez "window.location.reload()" dans la console JavaScript.
var BlankCordovaApp1;
(function (BlankCordovaApp1) {
"use strict";
var Application;
(function (Application) {
function initialize() {
document.addEventListener('deviceready', onDeviceReady, false);
}
Application.initialize = initialize;
function onDeviceReady() {
// Gérer les événements de suspension et de reprise Cordova
document.addEventListener('pause', onPause, false);
document.addEventListener('resume', onResume, false);
// TODO: Cordova a été chargé. Effectuez l'initialisation qui nécessite Cordova ici.
var parentElement = document.getElementById('deviceready');
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
}
function onPause() {
// TODO: cette application a été suspendue. Enregistrez l'état de l'application ici.
}
function onResume() {
// TODO: cette application a été réactivée. Restaurez l'état de l'application ici.
}
})(Application = BlankCordovaApp1.Application || (BlankCordovaApp1.Application = {}));
window.onload = function () {
Application.initialize();
};
})(BlankCordovaApp1 || (BlankCordovaApp1 = {}));
//# sourceMappingURL=appBundle.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"appBundle.js","sourceRoot":"","sources":["../../scripts/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,gDAAgD;AAChD,uKAAuK;AACvK,uEAAuE;AACvE,IAAO,gBAAgB,CAkCtB;AAlCD,WAAO,gBAAgB,EAAC,CAAC;IACrB,YAAY,CAAC;IAEb,IAAc,WAAW,CA0BxB;IA1BD,WAAc,WAAW,EAAC,CAAC;QACvB;YACI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QACnE,CAAC;QAFe,sBAAU,aAEzB,CAAA;QAED;YACI,2DAA2D;YAC3D,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YACnD,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAErD,oFAAoF;YACpF,IAAI,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAC3D,IAAI,gBAAgB,GAAG,aAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACjE,IAAI,eAAe,GAAG,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YAC/D,gBAAgB,CAAC,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YACxD,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC5D,CAAC;QAED;YACI,oFAAoF;QACxF,CAAC;QAED;YACI,kFAAkF;QACtF,CAAC;IAEL,CAAC,EA1Ba,WAAW,GAAX,4BAAW,KAAX,4BAAW,QA0BxB;IAED,MAAM,CAAC,MAAM,GAAG;QACZ,WAAW,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC,CAAA;AACL,CAAC,EAlCM,gBAAgB,KAAhB,gBAAgB,QAkCtB","sourcesContent":["// Pour obtenir une présentation du modèle Vide, consultez la documentation suivante :\r\n// http://go.microsoft.com/fwlink/?LinkID=397705\r\n// Pour déboguer du code durant le chargement d'une page dans Ripple ou sur les appareils/émulateurs Android, lancez votre application, définissez des points d'arrêt, \r\n// puis exécutez \"window.location.reload()\" dans la console JavaScript.\r\nmodule BlankCordovaApp1 {\r\n \"use strict\";\r\n\r\n export module Application {\r\n export function initialize() {\r\n document.addEventListener('deviceready', onDeviceReady, false);\r\n }\r\n\r\n function onDeviceReady() {\r\n // Gérer les événements de suspension et de reprise Cordova\r\n document.addEventListener('pause', onPause, false);\r\n document.addEventListener('resume', onResume, false);\r\n\r\n // TODO: Cordova a été chargé. Effectuez l'initialisation qui nécessite Cordova ici.\r\n var parentElement = document.getElementById('deviceready');\r\n var listeningElement = parentElement.querySelector('.listening');\r\n var receivedElement = parentElement.querySelector('.received');\r\n listeningElement.setAttribute('style', 'display:none;');\r\n receivedElement.setAttribute('style', 'display:block;');\r\n }\r\n\r\n function onPause() {\r\n // TODO: cette application a été suspendue. Enregistrez l'état de l'application ici.\r\n }\r\n\r\n function onResume() {\r\n // TODO: cette application a été réactivée. Restaurez l'état de l'application ici.\r\n }\r\n\r\n }\r\n\r\n window.onload = function () {\r\n Application.initialize();\r\n }\r\n}\r\n"]}

View File

@ -0,0 +1,4 @@
/*
Ce fichier est remplacé par du code spécifique à la plateforme provenant du dossier /merges.
Plus d'informations sur http://taco.visualstudio.com/fr-fr/docs/configure-app/#Content.
*/