UNPKG

@ideal-postcodes/postcode-lookup

Version:
37 lines (36 loc) 1.11 kB
/** * @module Setup */ import { Controller, ControllerConfig } from "./controller"; /** * Creates Postcode lookup field and button when called on <div> * * First argument `context` is a query selector string which designates where on the DOM the plugin will be instantiated * * Second argument `config` allows for advanced configuration of the plugin * * When invoked, an instance of the Postcode Lookup controller is stored in contollers * * Returns an instance of Postcode Lookup controller unless `checkKey: true`. If key checking is enabled, controller can be accessed by the `onLoaded` callback * * @example * *```javascript * PostcodeLookup.setup({ * context: "#container", * apiKey: "foo", * output_fields: { * line_1: "#address_line_1", * line_2: "#address_line_2", * line_3: "#address_line_3", * post_town: "#post_town", * postcode: "#postcode", * } * }); *``` */ export declare const setup: (config: ControllerConfig) => Controller; /** * Caches all instances of the plugin created via `setup` */ export declare const controllers: Controller[];