mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-07 23:03:19 +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-content>
|
||||||
<ion-list>
|
<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}}
|
{{plugin.name}}
|
||||||
</ion-item>
|
</button>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
@ -2,7 +2,9 @@ import {Page, NavController} from 'ionic/ionic'
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
ActionSheet,
|
ActionSheet,
|
||||||
|
BLE,
|
||||||
Camera,
|
Camera,
|
||||||
|
Contacts,
|
||||||
Device,
|
Device,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
Toast
|
Toast
|
||||||
@ -19,7 +21,9 @@ export class HomePage {
|
|||||||
|
|
||||||
this.plugins = [
|
this.plugins = [
|
||||||
ActionSheet,
|
ActionSheet,
|
||||||
|
BLE,
|
||||||
Camera,
|
Camera,
|
||||||
|
Contacts,
|
||||||
Device,
|
Device,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
Toast
|
Toast
|
||||||
|
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
export * from './plugins/actionsheet';
|
export * from './plugins/actionsheet';
|
||||||
|
export * from './plugins/ble';
|
||||||
export * from './plugins/camera';
|
export * from './plugins/camera';
|
||||||
|
export * from './plugins/contacts';
|
||||||
export * from './plugins/device';
|
export * from './plugins/device';
|
||||||
export * from './plugins/statusbar';
|
export * from './plugins/statusbar';
|
||||||
export * from './plugins/toast';
|
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;
|
var DEVICE_READY_TIMEOUT = 2000;
|
||||||
__export(require('./plugins/actionsheet'));
|
__export(require('./plugins/actionsheet'));
|
||||||
|
__export(require('./plugins/ble'));
|
||||||
__export(require('./plugins/camera'));
|
__export(require('./plugins/camera'));
|
||||||
|
__export(require('./plugins/contacts'));
|
||||||
__export(require('./plugins/device'));
|
__export(require('./plugins/device'));
|
||||||
__export(require('./plugins/statusbar'));
|
__export(require('./plugins/statusbar'));
|
||||||
__export(require('./plugins/toast'));
|
__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 {
|
export declare class BLE {
|
||||||
static scan(services: any[], seconds: number): void;
|
static scan(services: any[], seconds: number): void;
|
||||||
static startScan: any;
|
static startScan(services: any[]): void;
|
||||||
static stopScan: any;
|
static stopScan(): void;
|
||||||
static connect: any;
|
static connect(deviceId: string): void;
|
||||||
static disconnect: any;
|
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);
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||||
switch (arguments.length) {
|
switch (arguments.length) {
|
||||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||||
@ -11,37 +11,52 @@ var BLE = (function () {
|
|||||||
function BLE() {
|
function BLE() {
|
||||||
}
|
}
|
||||||
BLE.scan = function (services, seconds) { };
|
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",
|
Object.defineProperty(BLE, "scan",
|
||||||
__decorate([
|
__decorate([
|
||||||
plugin_1.Cordova({
|
plugin_1.Cordova()
|
||||||
successIndex: 2,
|
|
||||||
errIndex: 3
|
|
||||||
})
|
|
||||||
], BLE, "scan", Object.getOwnPropertyDescriptor(BLE, "scan")));
|
], BLE, "scan", Object.getOwnPropertyDescriptor(BLE, "scan")));
|
||||||
__decorate([
|
Object.defineProperty(BLE, "startScan",
|
||||||
plugin_1.Cordova({
|
__decorate([
|
||||||
successIndex: 1,
|
plugin_1.Cordova()
|
||||||
errIndex: 2
|
], BLE, "startScan", Object.getOwnPropertyDescriptor(BLE, "startScan")));
|
||||||
})
|
Object.defineProperty(BLE, "stopScan",
|
||||||
], BLE, "startScan");
|
__decorate([
|
||||||
__decorate([
|
plugin_1.Cordova()
|
||||||
plugin_1.Cordova({
|
], BLE, "stopScan", Object.getOwnPropertyDescriptor(BLE, "stopScan")));
|
||||||
successIndex: 0,
|
Object.defineProperty(BLE, "connect",
|
||||||
errIndex: 1
|
__decorate([
|
||||||
})
|
plugin_1.Cordova()
|
||||||
], BLE, "stopScan");
|
], BLE, "connect", Object.getOwnPropertyDescriptor(BLE, "connect")));
|
||||||
__decorate([
|
Object.defineProperty(BLE, "disconnect",
|
||||||
plugin_1.Cordova({
|
__decorate([
|
||||||
successIndex: 1,
|
plugin_1.Cordova()
|
||||||
errIndex: 2
|
], BLE, "disconnect", Object.getOwnPropertyDescriptor(BLE, "disconnect")));
|
||||||
})
|
Object.defineProperty(BLE, "read",
|
||||||
], BLE, "connect");
|
__decorate([
|
||||||
__decorate([
|
plugin_1.Cordova()
|
||||||
plugin_1.Cordova({
|
], BLE, "read", Object.getOwnPropertyDescriptor(BLE, "read")));
|
||||||
successIndex: 1,
|
Object.defineProperty(BLE, "write",
|
||||||
errIndex: 2
|
__decorate([
|
||||||
})
|
plugin_1.Cordova()
|
||||||
], BLE, "disconnect");
|
], BLE, "write", Object.getOwnPropertyDescriptor(BLE, "write")));
|
||||||
|
Object.defineProperty(BLE, "writeWithoutResponse",
|
||||||
|
__decorate([
|
||||||
|
plugin_1.Cordova()
|
||||||
|
], BLE, "writeWithoutResponse", Object.getOwnPropertyDescriptor(BLE, "writeWithoutResponse")));
|
||||||
BLE = __decorate([
|
BLE = __decorate([
|
||||||
plugin_1.Plugin({
|
plugin_1.Plugin({
|
||||||
name: 'BluetoothLowEnergy',
|
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') {
|
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||||
// If we've specified a success/error index
|
// If we've specified a success/error index
|
||||||
args[opts.successIndex] = resolve;
|
args.splice(opts.successIndex, resolve);
|
||||||
args[opts.errorIndex] = reject;
|
args.splice(opts.errorIndex, reject);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Otherwise, let's tack them on to the end of the argument list
|
// 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/actionsheet';
|
||||||
|
export * from './plugins/ble';
|
||||||
export * from './plugins/camera';
|
export * from './plugins/camera';
|
||||||
|
export * from './plugins/contacts';
|
||||||
export * from './plugins/device';
|
export * from './plugins/device';
|
||||||
export * from './plugins/statusbar';
|
export * from './plugins/statusbar';
|
||||||
export * from './plugins/toast';
|
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;
|
var DEVICE_READY_TIMEOUT = 2000;
|
||||||
__export(require('./plugins/actionsheet'));
|
__export(require('./plugins/actionsheet'));
|
||||||
|
__export(require('./plugins/ble'));
|
||||||
__export(require('./plugins/camera'));
|
__export(require('./plugins/camera'));
|
||||||
|
__export(require('./plugins/contacts'));
|
||||||
__export(require('./plugins/device'));
|
__export(require('./plugins/device'));
|
||||||
__export(require('./plugins/statusbar'));
|
__export(require('./plugins/statusbar'));
|
||||||
__export(require('./plugins/toast'));
|
__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;
|
args[1] = reject;
|
||||||
}
|
}
|
||||||
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||||
args[opts.successIndex] = resolve;
|
args.splice(opts.successIndex, resolve);
|
||||||
args[opts.errorIndex] = reject;
|
args.splice(opts.errorIndex, reject);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
args.push(resolve);
|
args.push(resolve);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "tsc --experimentalDecorators",
|
"build": "tsc --experimentalDecorators"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
const DEVICE_READY_TIMEOUT = 2000;
|
const DEVICE_READY_TIMEOUT = 2000;
|
||||||
|
|
||||||
export * from './plugins/actionsheet';
|
export * from './plugins/actionsheet';
|
||||||
|
export * from './plugins/ble';
|
||||||
export * from './plugins/camera';
|
export * from './plugins/camera';
|
||||||
|
export * from './plugins/contacts';
|
||||||
export * from './plugins/device';
|
export * from './plugins/device';
|
||||||
export * from './plugins/statusbar';
|
export * from './plugins/statusbar';
|
||||||
export * from './plugins/toast';
|
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;
|
args[1] = reject;
|
||||||
} else if(typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
} else if(typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||||
// If we've specified a success/error index
|
// If we've specified a success/error index
|
||||||
args[opts.successIndex] = resolve;
|
args.splice(opts.successIndex, resolve);
|
||||||
args[opts.errorIndex] = reject;
|
args.splice(opts.errorIndex, reject);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, let's tack them on to the end of the argument list
|
// Otherwise, let's tack them on to the end of the argument list
|
||||||
// which is 90% of cases
|
// which is 90% of cases
|
||||||
|
Loading…
Reference in New Issue
Block a user