refactoring

This commit is contained in:
Max Lynch
2015-11-29 19:54:45 -06:00
parent 9d54bfcd0b
commit dfef6dcfe8
42 changed files with 719 additions and 185 deletions
+4
View File
@@ -0,0 +1,4 @@
export declare class ActionSheet {
static show(options: any): void;
static hide(options: any): void;
}
+41
View File
@@ -0,0 +1,41 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var plugin_1 = require('./plugin');
var ActionSheet = (function () {
function ActionSheet() {
}
ActionSheet.show = function (options) { };
;
ActionSheet.hide = function (options) { };
;
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], ActionSheet, "show", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], ActionSheet, "hide", null);
ActionSheet = __decorate([
plugin_1.Plugin({
name: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet'
}),
__metadata('design:paramtypes', [])
], ActionSheet);
return ActionSheet;
})();
exports.ActionSheet = ActionSheet;
+10
View File
@@ -0,0 +1,10 @@
export declare class BLE {
static scan(services: any[], seconds: number): void;
static startScan(services: any[]): void;
static stopScan(): void;
static connect(deviceId: string): void;
static disconnect(deviceId: string): void;
static read(deviceId: string, serviceUUID: string, characteristicUUID: string): void;
static write(deviceId: string, serviceUUID: string, characteristicUUID: string, value: ArrayBuffer): void;
static writeWithoutResponse(deviceId: string, serviceUUID: string, characteristicUUID: string, value: ArrayBuffer): void;
}
+91
View File
@@ -0,0 +1,91 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var plugin_1 = require('./plugin');
var BLE = (function () {
function BLE() {
}
BLE.scan = function (services, seconds) { };
BLE.startScan = function (services) { };
;
BLE.stopScan = function () { };
;
BLE.connect = function (deviceId) { };
;
BLE.disconnect = function (deviceId) { };
;
BLE.read = function (deviceId, serviceUUID, characteristicUUID) { };
;
BLE.write = function (deviceId, serviceUUID, characteristicUUID, value) { };
;
BLE.writeWithoutResponse = function (deviceId, serviceUUID, characteristicUUID, value) { };
;
__decorate([
plugin_1.Cordova({
successIndex: 2,
errIndex: 3
}),
__metadata('design:type', Function),
__metadata('design:paramtypes', [Array, Number]),
__metadata('design:returntype', void 0)
], BLE, "scan", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [Array]),
__metadata('design:returntype', void 0)
], BLE, "startScan", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], BLE, "stopScan", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [String]),
__metadata('design:returntype', void 0)
], BLE, "connect", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [String]),
__metadata('design:returntype', void 0)
], BLE, "disconnect", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [String, String, String]),
__metadata('design:returntype', void 0)
], BLE, "read", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [String, String, String, ArrayBuffer]),
__metadata('design:returntype', void 0)
], BLE, "write", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [String, String, String, ArrayBuffer]),
__metadata('design:returntype', void 0)
], BLE, "writeWithoutResponse", null);
BLE = __decorate([
plugin_1.Plugin({
name: 'BluetoothLowEnergy',
plugin: 'cordova-plugin-ble-central',
pluginRef: 'ble',
pluginRepo: 'https://github.com/don/cordova-plugin-ble-central'
}),
__metadata('design:paramtypes', [])
], BLE);
return BLE;
})();
exports.BLE = BLE;
+2 -2
View File
@@ -1,4 +1,4 @@
export declare class Camera {
static getPicture: any;
static cleanup: any;
static getPicture(options: any): void;
static cleanup(): void;
}
+14 -10
View File
@@ -11,20 +11,24 @@ var plugin_1 = require('./plugin');
var Camera = (function () {
function Camera() {
}
Camera.getPicture = function (options) { };
;
Camera.cleanup = function () { };
;
__decorate([
plugin_1.Cordova({
successIndex: 0,
errIndex: 1
callbackOrder: 'reverse'
}),
__metadata('design:type', Object)
], Camera, "getPicture", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], Camera, "getPicture", null);
__decorate([
plugin_1.Cordova({
successIndex: 0,
errIndex: 1
}),
__metadata('design:type', Object)
], Camera, "cleanup", void 0);
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], Camera, "cleanup", null);
Camera = __decorate([
plugin_1.Plugin({
name: 'Camera',
+2
View File
@@ -0,0 +1,2 @@
export declare class File {
}
+24
View File
@@ -0,0 +1,24 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var plugin_1 = require('./plugin');
var File = (function () {
function File() {
}
File = __decorate([
plugin_1.Plugin({
name: 'File',
plugin: 'cordova-plugin-file',
pluginRef: 'cordova.file'
}),
__metadata('design:paramtypes', [])
], File);
return File;
})();
exports.File = File;
+3
View File
@@ -0,0 +1,3 @@
export declare class Device {
static getCurrentPosition(options: any): void;
}
+32
View File
@@ -0,0 +1,32 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var plugin_1 = require('./plugin');
var Device = (function () {
function Device() {
}
Device.getCurrentPosition = function (options) { };
;
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], Device, "getCurrentPosition", null);
Device = __decorate([
plugin_1.Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation'
}),
__metadata('design:paramtypes', [])
], Device);
return Device;
})();
exports.Device = Device;
+3 -1
View File
@@ -4,5 +4,7 @@ export declare const pluginWarn: (pluginName: string, method: string, plugin: st
export declare const cordovaWarn: (pluginName: string, method: string) => void;
export declare const wrap: (pluginObj: any, methodName: any, opts?: any) => (...args: any[]) => any;
export declare function Plugin(config: any): (cls: any) => any;
export declare function Cordova(opts?: any): (obj: any, methodName: any) => void;
export declare function Cordova(opts?: any): (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
value: (...args: any[]) => any;
};
export declare function RequiresPlugin(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>): TypedPropertyDescriptor<any>;
+20 -8
View File
@@ -38,12 +38,18 @@ exports.wrap = function (pluginObj, methodName, opts) {
});
return;
}
if (typeof opts.successIndex !== 'undefined') {
args[opts.successIndex] = resolve;
if (opts.callbackOrder == 'reverse') {
args[0] = resolve;
args[1] = reject;
}
if (typeof opts.errorIndex !== 'undefined') {
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
args[opts.successIndex] = resolve;
args[opts.errorIndex] = reject;
}
else {
args.push(resolve);
args.push(reject);
}
var pluginInstance = exports.getPlugin(pluginObj.pluginRef);
if (!pluginInstance) {
exports.pluginWarn(pluginObj.name, methodName, pluginObj.name);
@@ -67,11 +73,17 @@ function Plugin(config) {
exports.Plugin = Plugin;
function Cordova(opts) {
if (opts === void 0) { opts = {}; }
return function (obj, methodName) {
if (opts.promise) {
console.log('TODO: Promise');
}
obj[methodName] = exports.wrap(obj, methodName, opts).bind(obj);
return function (target, methodName, descriptor) {
var originalMethod = descriptor.value;
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return exports.wrap(this, methodName, opts)();
}
};
};
}
exports.Cordova = Cordova;
+9 -9
View File
@@ -1,11 +1,11 @@
export declare class StatusBar {
static overlaysWebView: any;
static styleDefault: any;
static styleLightContent: any;
static styleBlackTranslucent: any;
static styleBlackOpaque: any;
static backgroundColorByName: any;
static backgroundColorByHexString: any;
static hide: any;
static show: any;
static overlaysWebView(doOverlay: boolean): void;
static styleDefault(): void;
static styleLightContent(): void;
static styleBlackTranslucent(): void;
static styleBlackOpaque(): void;
static backgroundColorByName(colorName: string): void;
static backgroundColorByHexString(hexString: string): void;
static hide(): void;
static show(): void;
}
+54 -18
View File
@@ -11,42 +11,78 @@ var plugin_1 = require('./plugin');
var StatusBar = (function () {
function StatusBar() {
}
StatusBar.overlaysWebView = function (doOverlay) { };
;
StatusBar.styleDefault = function () { };
;
StatusBar.styleLightContent = function () { };
;
StatusBar.styleBlackTranslucent = function () { };
;
StatusBar.styleBlackOpaque = function () { };
;
StatusBar.backgroundColorByName = function (colorName) { };
;
StatusBar.backgroundColorByHexString = function (hexString) { };
;
StatusBar.hide = function () { };
;
StatusBar.show = function () { };
;
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "overlaysWebView", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', [Boolean]),
__metadata('design:returntype', void 0)
], StatusBar, "overlaysWebView", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "styleDefault", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], StatusBar, "styleDefault", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "styleLightContent", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], StatusBar, "styleLightContent", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "styleBlackTranslucent", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], StatusBar, "styleBlackTranslucent", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "styleBlackOpaque", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], StatusBar, "styleBlackOpaque", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "backgroundColorByName", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', [String]),
__metadata('design:returntype', void 0)
], StatusBar, "backgroundColorByName", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "backgroundColorByHexString", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', [String]),
__metadata('design:returntype', void 0)
], StatusBar, "backgroundColorByHexString", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "hide", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], StatusBar, "hide", null);
__decorate([
plugin_1.Cordova(),
__metadata('design:type', Object)
], StatusBar, "show", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], StatusBar, "show", null);
StatusBar = __decorate([
plugin_1.Plugin({
name: 'StatusBar',
+2 -2
View File
@@ -1,4 +1,4 @@
export declare class Toast {
static hide: any;
static showWithOptions: any;
static hide(): void;
static showWithOptions(options: any): void;
}
+12 -4
View File
@@ -11,20 +11,28 @@ var plugin_1 = require('./plugin');
var Toast = (function () {
function Toast() {
}
Toast.hide = function () { };
;
Toast.showWithOptions = function (options) { };
;
__decorate([
plugin_1.Cordova({
successIndex: 0,
errIndex: 1
}),
__metadata('design:type', Object)
], Toast, "hide", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], Toast, "hide", null);
__decorate([
plugin_1.Cordova({
successIndex: 1,
errIndex: 2
}),
__metadata('design:type', Object)
], Toast, "showWithOptions", void 0);
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], Toast, "showWithOptions", null);
Toast = __decorate([
plugin_1.Plugin({
name: 'Toast',