Skip to content

Commit

Permalink
adds mandatory key parameter, makes events optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tsamaya committed Oct 18, 2023
1 parent 424bf06 commit 0ba1b6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/nodejs-example/nodejs-example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-check
const { OpenCageGeoSearchPlugin } = require('@opencage/geosearch-core');

// eslint-disable-next-line import/no-extraneous-dependencies
Expand All @@ -6,7 +7,7 @@ require('isomorphic-unfetch');
console.log(typeof OpenCageGeoSearchPlugin);

const options = {
key: process.env.OPENCAGE_SEARCH_TOKEN,
key: process.env.OPENCAGE_SEARCH_TOKEN || '',
};

const plugin = OpenCageGeoSearchPlugin(options);
Expand Down
6 changes: 5 additions & 1 deletion packages/geosearch-core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import {

declare module '@opencage/geosearch-core' {
interface OpenCageGeoSearchPluginOptions {
/**
* The GEOSEARCH Key
*/
key: string;
/**
* restricts the possible results to a defined bounding box.
*
Expand Down Expand Up @@ -92,6 +96,6 @@ declare module '@opencage/geosearch-core' {

export function OpenCageGeoSearchPlugin(
options: OpenCageGeoSearchPluginOptions,
events: OpenCageGeoSearchPluginEvents
events?: OpenCageGeoSearchPluginEvents
): AutocompletePlugin<any, any>;
}

0 comments on commit 0ba1b6e

Please sign in to comment.