mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 18:49:43 +08:00
🧈
This commit is contained in:
parent
226c182039
commit
b6e612209a
4
demo/ionic.project
Normal file
4
demo/ionic.project
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "demo",
|
||||
"app_id": ""
|
||||
}
|
@ -6,8 +6,8 @@
|
||||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<ion-item *ng-for="#plugin of plugins" (click)="choosePlugin(plugin)">
|
||||
<button ion-item *ng-for="#plugin of plugins" (click)="choosePlugin(plugin)">
|
||||
{{plugin.name}}
|
||||
</ion-item>
|
||||
</button>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
@ -2,7 +2,9 @@ import {Page, NavController} from 'ionic/ionic'
|
||||
|
||||
import {
|
||||
ActionSheet,
|
||||
BLE,
|
||||
Camera,
|
||||
Contacts,
|
||||
Device,
|
||||
StatusBar,
|
||||
Toast
|
||||
@ -19,7 +21,9 @@ export class HomePage {
|
||||
|
||||
this.plugins = [
|
||||
ActionSheet,
|
||||
BLE,
|
||||
Camera,
|
||||
Contacts,
|
||||
Device,
|
||||
StatusBar,
|
||||
Toast
|
||||
|
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,5 +1,7 @@
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/ble';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/contacts';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -3,7 +3,9 @@ function __export(m) {
|
||||
}
|
||||
var DEVICE_READY_TIMEOUT = 2000;
|
||||
__export(require('./plugins/actionsheet'));
|
||||
__export(require('./plugins/ble'));
|
||||
__export(require('./plugins/camera'));
|
||||
__export(require('./plugins/contacts'));
|
||||
__export(require('./plugins/device'));
|
||||
__export(require('./plugins/statusbar'));
|
||||
__export(require('./plugins/toast'));
|
||||
|
11
dist/plugins/ble.d.ts
vendored
11
dist/plugins/ble.d.ts
vendored
@ -1,7 +1,10 @@
|
||||
export declare class BLE {
|
||||
static scan(services: any[], seconds: number): void;
|
||||
static startScan: any;
|
||||
static stopScan: any;
|
||||
static connect: any;
|
||||
static disconnect: any;
|
||||
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;
|
||||
}
|
||||
|
73
dist/plugins/ble.js
vendored
73
dist/plugins/ble.js
vendored
@ -1,4 +1,4 @@
|
||||
if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) {
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
@ -11,37 +11,52 @@ 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) { };
|
||||
;
|
||||
Object.defineProperty(BLE, "scan",
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 2,
|
||||
errIndex: 3
|
||||
})
|
||||
plugin_1.Cordova()
|
||||
], BLE, "scan", Object.getOwnPropertyDescriptor(BLE, "scan")));
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 1,
|
||||
errIndex: 2
|
||||
})
|
||||
], BLE, "startScan");
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 0,
|
||||
errIndex: 1
|
||||
})
|
||||
], BLE, "stopScan");
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 1,
|
||||
errIndex: 2
|
||||
})
|
||||
], BLE, "connect");
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 1,
|
||||
errIndex: 2
|
||||
})
|
||||
], BLE, "disconnect");
|
||||
Object.defineProperty(BLE, "startScan",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "startScan", Object.getOwnPropertyDescriptor(BLE, "startScan")));
|
||||
Object.defineProperty(BLE, "stopScan",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "stopScan", Object.getOwnPropertyDescriptor(BLE, "stopScan")));
|
||||
Object.defineProperty(BLE, "connect",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "connect", Object.getOwnPropertyDescriptor(BLE, "connect")));
|
||||
Object.defineProperty(BLE, "disconnect",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "disconnect", Object.getOwnPropertyDescriptor(BLE, "disconnect")));
|
||||
Object.defineProperty(BLE, "read",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "read", Object.getOwnPropertyDescriptor(BLE, "read")));
|
||||
Object.defineProperty(BLE, "write",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "write", Object.getOwnPropertyDescriptor(BLE, "write")));
|
||||
Object.defineProperty(BLE, "writeWithoutResponse",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], BLE, "writeWithoutResponse", Object.getOwnPropertyDescriptor(BLE, "writeWithoutResponse")));
|
||||
BLE = __decorate([
|
||||
plugin_1.Plugin({
|
||||
name: 'BluetoothLowEnergy',
|
||||
|
5
dist/plugins/contacts.d.ts
vendored
Normal file
5
dist/plugins/contacts.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export declare class Contacts {
|
||||
static create(fields: string[], options: any): void;
|
||||
static find(fields: string[], options: any): void;
|
||||
static pickContact(): void;
|
||||
}
|
47
dist/plugins/contacts.js
vendored
Normal file
47
dist/plugins/contacts.js
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||
}
|
||||
};
|
||||
var plugin_1 = require('./plugin');
|
||||
var Contacts = (function () {
|
||||
function Contacts() {
|
||||
}
|
||||
Contacts.create = function (fields, options) { };
|
||||
;
|
||||
Contacts.find = function (fields, options) { };
|
||||
;
|
||||
Contacts.pickContact = function () { };
|
||||
;
|
||||
Object.defineProperty(Contacts, "create",
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
], Contacts, "create", Object.getOwnPropertyDescriptor(Contacts, "create")));
|
||||
Object.defineProperty(Contacts, "find",
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
], Contacts, "find", Object.getOwnPropertyDescriptor(Contacts, "find")));
|
||||
Object.defineProperty(Contacts, "pickContact",
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], Contacts, "pickContact", Object.getOwnPropertyDescriptor(Contacts, "pickContact")));
|
||||
Contacts = __decorate([
|
||||
plugin_1.Plugin({
|
||||
name: 'Contacts',
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||||
})
|
||||
], Contacts);
|
||||
return Contacts;
|
||||
})();
|
||||
exports.Contacts = Contacts;
|
4
dist/plugins/plugin.js
vendored
4
dist/plugins/plugin.js
vendored
@ -49,8 +49,8 @@ exports.wrap = function (pluginObj, methodName, opts) {
|
||||
}
|
||||
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
// If we've specified a success/error index
|
||||
args[opts.successIndex] = resolve;
|
||||
args[opts.errorIndex] = reject;
|
||||
args.splice(opts.successIndex, resolve);
|
||||
args.splice(opts.errorIndex, reject);
|
||||
}
|
||||
else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
|
2
dist/src/index.d.ts
vendored
2
dist/src/index.d.ts
vendored
@ -1,5 +1,7 @@
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/ble';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/contacts';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
2
dist/src/index.js
vendored
2
dist/src/index.js
vendored
@ -3,7 +3,9 @@ function __export(m) {
|
||||
}
|
||||
var DEVICE_READY_TIMEOUT = 2000;
|
||||
__export(require('./plugins/actionsheet'));
|
||||
__export(require('./plugins/ble'));
|
||||
__export(require('./plugins/camera'));
|
||||
__export(require('./plugins/contacts'));
|
||||
__export(require('./plugins/device'));
|
||||
__export(require('./plugins/statusbar'));
|
||||
__export(require('./plugins/toast'));
|
||||
|
4
dist/src/plugins/plugin.js
vendored
4
dist/src/plugins/plugin.js
vendored
@ -45,8 +45,8 @@ exports.wrap = function (pluginObj, methodName, opts) {
|
||||
args[1] = reject;
|
||||
}
|
||||
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
args[opts.successIndex] = resolve;
|
||||
args[opts.errorIndex] = reject;
|
||||
args.splice(opts.successIndex, resolve);
|
||||
args.splice(opts.errorIndex, reject);
|
||||
}
|
||||
else {
|
||||
args.push(resolve);
|
||||
|
@ -11,7 +11,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "tsc --experimentalDecorators",
|
||||
"build": "tsc --experimentalDecorators"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,7 +1,9 @@
|
||||
const DEVICE_READY_TIMEOUT = 2000;
|
||||
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/ble';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/contacts';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
25
src/plugins/contacts.ts
Normal file
25
src/plugins/contacts.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
@Plugin({
|
||||
name: 'Contacts',
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||||
})
|
||||
export class Contacts {
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
// This method is create(fields, success, error, options) :/
|
||||
static create(fields:string[], options:any){};
|
||||
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static find(fields:string[], options:any){};
|
||||
|
||||
@Cordova()
|
||||
static pickContact(){};
|
||||
}
|
@ -50,8 +50,8 @@ export const wrap = function(pluginObj, methodName, opts: any = {}) {
|
||||
args[1] = reject;
|
||||
} else if(typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
// If we've specified a success/error index
|
||||
args[opts.successIndex] = resolve;
|
||||
args[opts.errorIndex] = reject;
|
||||
args.splice(opts.successIndex, resolve);
|
||||
args.splice(opts.errorIndex, reject);
|
||||
} else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
// which is 90% of cases
|
||||
|
Loading…
Reference in New Issue
Block a user