mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-20 00:06:24 +08:00
Device ready call
This commit is contained in:
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/toast';
|
||||
|
||||
Vendored
+11
@@ -1,6 +1,17 @@
|
||||
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/statusbar'));
|
||||
__export(require('./plugins/toast'));
|
||||
var didFireReady = false;
|
||||
window.addEventListener('deviceready', function () {
|
||||
didFireReady = true;
|
||||
});
|
||||
setTimeout(function () {
|
||||
if (!didFireReady && window.cordova) {
|
||||
console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.');
|
||||
}
|
||||
}, DEVICE_READY_TIMEOUT);
|
||||
|
||||
Vendored
-1
@@ -8,7 +8,6 @@ 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 PLUGIN_REF = 'navigator.camera';
|
||||
var Camera = (function () {
|
||||
function Camera() {
|
||||
}
|
||||
|
||||
Vendored
+6
-1
@@ -6,8 +6,13 @@ exports.wrap = function (pluginObj, methodName, opts) {
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
console.log('Trying', pluginObj.name, methodName, args);
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!window.cordova) {
|
||||
console.warn('Native: tried calling ' + pluginObj.name + '.' + methodName + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
reject({
|
||||
error: 'cordova_not_available'
|
||||
});
|
||||
}
|
||||
if (typeof opts.successIndex !== 'undefined') {
|
||||
args[opts.successIndex] = resolve;
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -29,7 +29,8 @@ var Toast = (function () {
|
||||
plugin_1.Plugin({
|
||||
name: 'Toast',
|
||||
plugin: 'cordova-plugin-x-toast',
|
||||
pluginRef: 'plugins.toast'
|
||||
pluginRef: 'plugins.toast',
|
||||
repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin'
|
||||
}),
|
||||
__metadata('design:paramtypes', [])
|
||||
], Toast);
|
||||
|
||||
Vendored
+3
@@ -1,5 +1,8 @@
|
||||
function get(obj, path) {
|
||||
for (var i = 0, path = path.split('.'), len = path.length; i < len; i++) {
|
||||
if (!obj) {
|
||||
return null;
|
||||
}
|
||||
obj = obj[path[i]];
|
||||
}
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user