From b09eb06cb02abe55d3964b7784c407e428ad2d98 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 9 Apr 2018 14:32:20 -0400 Subject: [PATCH] Update code style --- .../core/decorators/common.spec.ts | 6 ++-- src/@ionic-native/core/decorators/common.ts | 29 ++++++++++--------- .../decorators/cordova-function-override.ts | 2 +- .../core/decorators/cordova-instance.ts | 2 +- src/@ionic-native/core/decorators/cordova.ts | 2 +- .../core/decorators/interfaces.ts | 6 ++-- src/@ionic-native/core/ng1.ts | 4 +-- 7 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/@ionic-native/core/decorators/common.spec.ts b/src/@ionic-native/core/decorators/common.spec.ts index 06c305c86..852f2a2c4 100644 --- a/src/@ionic-native/core/decorators/common.spec.ts +++ b/src/@ionic-native/core/decorators/common.spec.ts @@ -1,4 +1,5 @@ -import { callCordovaPlugin, wrapInstance, wrapPromise } from './common'; +import { callCordovaPlugin, wrapPromise } from './common'; + declare const window: any; class MockPlugin { @@ -29,11 +30,10 @@ class MockInstancePluginObject { class MockCordovaPlugin { static ping = jest.fn((arg: string) => 'pong'); - ping = jest.fn((arg: string) => 'pong'); - static pingAsync = jest.fn( (arg: string, success: Function, error: Function) => success('pong') ); + ping = jest.fn((arg: string) => 'pong'); pingAsync = jest.fn((arg: string, success: Function, error: Function) => success('pong') ); diff --git a/src/@ionic-native/core/decorators/common.ts b/src/@ionic-native/core/decorators/common.ts index 0332ad5fc..66147f785 100644 --- a/src/@ionic-native/core/decorators/common.ts +++ b/src/@ionic-native/core/decorators/common.ts @@ -286,7 +286,8 @@ export function setIndex( }; const setErrorIndex = () => { - // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behavior. + // We don't want that the reject cb gets spliced into the position of an optional argument that has not been + // defined and thus causing non expected behavior. if (opts.errorIndex > args.length) { args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index } else { @@ -374,12 +375,12 @@ export function pluginWarn( if (method) { console.warn( 'Native: tried calling ' + - pluginName + - '.' + - method + - ', but the ' + - pluginName + - ' plugin is not installed.' + pluginName + + '.' + + method + + ', but the ' + + pluginName + + ' plugin is not installed.' ); } else { console.warn( @@ -402,16 +403,16 @@ export function cordovaWarn(pluginName: string, method?: string): void { 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' + 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' + pluginName + + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator' ); } } @@ -419,7 +420,7 @@ export function cordovaWarn(pluginName: string, method?: string): void { /** * @private */ -export const wrap = function( +export const wrap = function ( pluginObj: any, methodName: string, opts: CordovaOptions = {} diff --git a/src/@ionic-native/core/decorators/cordova-function-override.ts b/src/@ionic-native/core/decorators/cordova-function-override.ts index 9e68af3e4..63c8a0987 100644 --- a/src/@ionic-native/core/decorators/cordova-function-override.ts +++ b/src/@ionic-native/core/decorators/cordova-function-override.ts @@ -1,5 +1,5 @@ -import { checkAvailability, getPlugin } from './common'; import { Observable } from 'rxjs'; +import { checkAvailability, getPlugin } from './common'; function overrideFunction(pluginObj: any, methodName: string): Observable { return new Observable(observer => { diff --git a/src/@ionic-native/core/decorators/cordova-instance.ts b/src/@ionic-native/core/decorators/cordova-instance.ts index ff6efa61b..7dc27228d 100644 --- a/src/@ionic-native/core/decorators/cordova-instance.ts +++ b/src/@ionic-native/core/decorators/cordova-instance.ts @@ -1,5 +1,5 @@ -import { CordovaOptions } from './interfaces'; import { wrapInstance } from './common'; +import { CordovaOptions } from './interfaces'; export function cordovaInstance(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | Array) { args = Array.from(args); diff --git a/src/@ionic-native/core/decorators/cordova.ts b/src/@ionic-native/core/decorators/cordova.ts index fe823d147..c63186944 100644 --- a/src/@ionic-native/core/decorators/cordova.ts +++ b/src/@ionic-native/core/decorators/cordova.ts @@ -1,5 +1,5 @@ -import { CordovaOptions } from './interfaces'; import { wrap } from './common'; +import { CordovaOptions } from './interfaces'; export function cordova(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | Array) { return wrap(pluginObj, methodName, config).apply(this, args); diff --git a/src/@ionic-native/core/decorators/interfaces.ts b/src/@ionic-native/core/decorators/interfaces.ts index 487ee026a..00e42c84f 100644 --- a/src/@ionic-native/core/decorators/interfaces.ts +++ b/src/@ionic-native/core/decorators/interfaces.ts @@ -38,7 +38,8 @@ export interface CordovaOptions { */ sync?: boolean; /** - * Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method takes. + * Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method + * takes. */ callbackOrder?: 'reverse'; /** @@ -70,7 +71,8 @@ export interface CordovaOptions { */ clearFunction?: string; /** - * This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function. + * This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used + * in the initial function. */ clearWithArgs?: boolean; /** diff --git a/src/@ionic-native/core/ng1.ts b/src/@ionic-native/core/ng1.ts index e0907a70b..9ac417e3c 100644 --- a/src/@ionic-native/core/ng1.ts +++ b/src/@ionic-native/core/ng1.ts @@ -13,8 +13,8 @@ export function initAngular1(plugins: any) { const serviceName = '$cordova' + name; const cls = plugins[name]; - (function(serviceName, cls, name) { - ngModule.service(serviceName, [function() { + (function (serviceName, cls, name) { + ngModule.service(serviceName, [function () { const funcs = window.angular.copy(cls); funcs.__proto__['name'] = name; return funcs;