mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
Merge pull request #24 from ihadeed/clean-up
refactor: added semi-columns
This commit is contained in:
commit
848c6c3772
@ -66,7 +66,7 @@ window['IonicNative'] = {
|
||||
StatusBar: StatusBar,
|
||||
Toast: Toast,
|
||||
TouchID: TouchID
|
||||
}
|
||||
};
|
||||
|
||||
// To help developers using cordova, we listen for the device ready event and
|
||||
// log an error if it didn't fire in a reasonable amount of time. Generally,
|
||||
@ -76,9 +76,9 @@ let before = +new Date;
|
||||
|
||||
let didFireReady = false;
|
||||
document.addEventListener('deviceready', function() {
|
||||
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms')
|
||||
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
|
||||
didFireReady = true;
|
||||
})
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
if(!didFireReady && window.cordova) {
|
||||
|
@ -11,10 +11,10 @@ import {Observable} from 'rxjs/Observable';
|
||||
|
||||
export const getPlugin = function(pluginRef: string): any {
|
||||
return get(window, pluginRef);
|
||||
}
|
||||
};
|
||||
export const isInstalled = function(pluginRef: string): boolean {
|
||||
return !!getPlugin(pluginRef);
|
||||
}
|
||||
};
|
||||
export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
var pluginName = pluginObj.name;
|
||||
var plugin = pluginObj.plugin;
|
||||
@ -24,14 +24,14 @@ export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
|
||||
}
|
||||
console.warn('Install the ' + pluginName + ' plugin: \'cordova plugin add ' + plugin + '\'');
|
||||
}
|
||||
};
|
||||
export const cordovaWarn = function(pluginName: string, method: string) {
|
||||
if(method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
} else {
|
||||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:any={}, resolve?: Function, reject?: Function) {
|
||||
// Try to figure out where the success/error callbacks need to be bound
|
||||
@ -61,7 +61,7 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an
|
||||
cordovaWarn(pluginObj.name, methodName);
|
||||
reject && reject({
|
||||
error: 'cordova_not_available'
|
||||
})
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) {
|
||||
return wrapPromise(pluginObj, methodName, args, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Class decorator specifying Plugin metadata. Required for all plugins.
|
||||
@ -145,7 +145,7 @@ export function Plugin(config) {
|
||||
|
||||
cls['installed'] = function() {
|
||||
return !!getPlugin(config.pluginRef);
|
||||
}
|
||||
};
|
||||
|
||||
return cls;
|
||||
}
|
||||
@ -186,7 +186,7 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed
|
||||
return {};
|
||||
}
|
||||
return originalMethod.apply(this, args);
|
||||
}
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user