Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
OS-pedrogustavobilro committed Jan 8, 2025
1 parent 6b9f115 commit 842d0a9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
14 changes: 3 additions & 11 deletions packages/capacitor-plugin/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ export interface IGeolocationPlugin {
*
* @since 1.0.0
*/
watchPosition(
options: PositionOptions,
callback: WatchPositionCallback,
): Promise<CallbackID>;
watchPosition(options: PositionOptions, callback: WatchPositionCallback): Promise<CallbackID>;

/**
* Clear a given watch
Expand All @@ -75,9 +72,7 @@ export interface IGeolocationPlugin {
*
* @since 1.0.0
*/
requestPermissions(
permissions?: GeolocationPluginPermissions,
): Promise<PermissionStatus>;
requestPermissions(permissions?: GeolocationPluginPermissions): Promise<PermissionStatus>;
}

export interface ClearWatchOptions {
Expand Down Expand Up @@ -195,7 +190,4 @@ export interface PositionOptions {
minimumUpdateInterval?: number;
}

export type WatchPositionCallback = (
position: Position | null,
err?: any,
) => void;
export type WatchPositionCallback = (position: Position | null, err?: any) => void;
1 change: 0 additions & 1 deletion packages/capacitor-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { exposeSynapse } from '@capacitor/synapse';

import type { IGeolocationPlugin } from './definitions';


const GeolocationPlugin = registerPlugin<IGeolocationPlugin>('GeolocationPlugin', {
web: () => import('./web').then((m) => new m.GeolocationPluginWeb()),
});
Expand Down
19 changes: 13 additions & 6 deletions packages/capacitor-plugin/src/web.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { WebPlugin } from '@capacitor/core';

import type { CallbackID, IGeolocationPlugin, PermissionStatus, Position, PositionOptions, WatchPositionCallback } from './definitions';
import type {
CallbackID,
IGeolocationPlugin,
PermissionStatus,
Position,
PositionOptions,
WatchPositionCallback,
} from './definitions';

export class GeolocationPluginWeb extends WebPlugin implements IGeolocationPlugin {
async getCurrentPosition(options?: PositionOptions): Promise<Position> {
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(
pos => {
(pos) => {
resolve(pos);
},
err => {
(err) => {
reject(err);
},
{
Expand All @@ -24,10 +31,10 @@ export class GeolocationPluginWeb extends WebPlugin implements IGeolocationPlugi

async watchPosition(options: PositionOptions, callback: WatchPositionCallback): Promise<CallbackID> {
const id = navigator.geolocation.watchPosition(
pos => {
(pos) => {
callback(pos);
},
err => {
(err) => {
callback(null, err);
},

Expand Down Expand Up @@ -64,4 +71,4 @@ export class GeolocationPluginWeb extends WebPlugin implements IGeolocationPlugi

const Geolocation = new GeolocationPluginWeb();

export { Geolocation };
export { Geolocation };

0 comments on commit 842d0a9

Please sign in to comment.