mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
:derp:
This commit is contained in:
parent
dfef6dcfe8
commit
af5b3de227
@ -23,7 +23,9 @@ export class HomePage {
|
||||
Device,
|
||||
StatusBar,
|
||||
Toast
|
||||
];
|
||||
].filter((p) => {
|
||||
return !!p;
|
||||
});
|
||||
console.log('PLUGINS', this.plugins);
|
||||
}
|
||||
|
||||
|
4
dist/index.d.ts
vendored
4
dist/index.d.ts
vendored
@ -1,5 +1 @@
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -2,10 +2,10 @@ function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
var DEVICE_READY_TIMEOUT = 2000;
|
||||
__export(require('./plugins/actionsheet'));
|
||||
__export(require('./plugins/camera'));
|
||||
__export(require('./plugins/device'));
|
||||
__export(require('./plugins/statusbar'));
|
||||
//export * from './plugins/actionsheet';
|
||||
//export * from './plugins/camera';
|
||||
//export * from './plugins/device';
|
||||
//export * from './plugins/statusbar';
|
||||
__export(require('./plugins/toast'));
|
||||
var didFireReady = false;
|
||||
window.addEventListener('deviceready', function () {
|
||||
|
5
dist/plugins/plugin.js
vendored
5
dist/plugins/plugin.js
vendored
@ -25,11 +25,13 @@ exports.cordovaWarn = function (pluginName, method) {
|
||||
};
|
||||
exports.wrap = function (pluginObj, methodName, opts) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
console.log('Wrap', pluginObj.name, methodName);
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
console.log('Wrap CALLED', pluginObj.name, methodName, args);
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!window.cordova) {
|
||||
exports.cordovaWarn(pluginObj.name, methodName);
|
||||
@ -64,6 +66,7 @@ exports.wrap = function (pluginObj, methodName, opts) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log('Cordova calling', pluginObj.name, methodName, args);
|
||||
util_1.get(window, pluginObj.pluginRef)[methodName].apply(pluginObj, args);
|
||||
});
|
||||
};
|
||||
@ -95,7 +98,7 @@ function Cordova(opts) {
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
return exports.wrap(this, methodName, opts)();
|
||||
return exports.wrap(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
4
dist/plugins/toast.js
vendored
4
dist/plugins/toast.js
vendored
@ -12,7 +12,9 @@ var Toast = (function () {
|
||||
}
|
||||
Toast.hide = function () { };
|
||||
;
|
||||
Toast.showWithOptions = function (options) { };
|
||||
Toast.showWithOptions = function (options) {
|
||||
console.log('Show with options');
|
||||
};
|
||||
;
|
||||
Object.defineProperty(Toast, "hide",
|
||||
__decorate([
|
||||
|
4
dist/src/index.d.ts
vendored
4
dist/src/index.d.ts
vendored
@ -1,5 +1 @@
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
4
dist/src/index.js
vendored
4
dist/src/index.js
vendored
@ -2,10 +2,6 @@ function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
var DEVICE_READY_TIMEOUT = 2000;
|
||||
__export(require('./plugins/actionsheet'));
|
||||
__export(require('./plugins/camera'));
|
||||
__export(require('./plugins/device'));
|
||||
__export(require('./plugins/statusbar'));
|
||||
__export(require('./plugins/toast'));
|
||||
var didFireReady = false;
|
||||
window.addEventListener('deviceready', function () {
|
||||
|
5
dist/src/plugins/plugin.js
vendored
5
dist/src/plugins/plugin.js
vendored
@ -25,11 +25,13 @@ exports.cordovaWarn = function (pluginName, method) {
|
||||
};
|
||||
exports.wrap = function (pluginObj, methodName, opts) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
console.log('Wrap', pluginObj.name, methodName);
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
console.log('Wrap CALLED', pluginObj.name, methodName, args);
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!window.cordova) {
|
||||
exports.cordovaWarn(pluginObj.name, methodName);
|
||||
@ -58,6 +60,7 @@ exports.wrap = function (pluginObj, methodName, opts) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log('Cordova calling', pluginObj.name, methodName, args);
|
||||
util_1.get(window, pluginObj.pluginRef)[methodName].apply(pluginObj, args);
|
||||
});
|
||||
};
|
||||
@ -81,7 +84,7 @@ function Cordova(opts) {
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
return exports.wrap(this, methodName, opts)();
|
||||
return exports.wrap(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
4
dist/src/plugins/toast.js
vendored
4
dist/src/plugins/toast.js
vendored
@ -13,7 +13,9 @@ var Toast = (function () {
|
||||
}
|
||||
Toast.hide = function () { };
|
||||
;
|
||||
Toast.showWithOptions = function (options) { };
|
||||
Toast.showWithOptions = function (options) {
|
||||
console.log('Show with options');
|
||||
};
|
||||
;
|
||||
__decorate([
|
||||
plugin_1.Cordova({
|
||||
|
@ -1,9 +1,9 @@
|
||||
const DEVICE_READY_TIMEOUT = 2000;
|
||||
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/statusbar';
|
||||
//export * from './plugins/actionsheet';
|
||||
//export * from './plugins/camera';
|
||||
//export * from './plugins/device';
|
||||
//export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
||||
|
||||
|
@ -28,7 +28,9 @@ export const cordovaWarn = function(pluginName: string, method: string) {
|
||||
}
|
||||
|
||||
export const wrap = function(pluginObj, methodName, opts: any = {}) {
|
||||
console.log('Wrap', pluginObj.name, methodName);
|
||||
return (...args) => {
|
||||
console.log('Wrap CALLED', pluginObj.name, methodName, args);
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
if(!window.cordova) {
|
||||
@ -67,6 +69,8 @@ export const wrap = function(pluginObj, methodName, opts: any = {}) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Cordova calling', pluginObj.name, methodName, args);
|
||||
|
||||
get(window, pluginObj.pluginRef)[methodName].apply(pluginObj, args);
|
||||
})
|
||||
}
|
||||
@ -97,7 +101,7 @@ export function Cordova(opts:any = {}) {
|
||||
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrap(this, methodName, opts)();
|
||||
return wrap(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,7 @@ export class Toast {
|
||||
successIndex: 1,
|
||||
errIndex: 2
|
||||
})
|
||||
static showWithOptions(options:any){};
|
||||
static showWithOptions(options:any){
|
||||
console.log('Show with options');
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user