[//]: # "Comment"
npm install @firstclasspostcodes/plugin[//]: # "Comment"
Our browser plugin is compatible with all modern browsers and IE9+ _(polyfills required)_.
This simple to use plugin helps you to get started quickly, allowing you to add postcode lookup to any address form in minutes.
``html`
Note on older browsers: You will need to use a polyfill service, the following example covers all of the required language features:
`html`
`html`
All JS library versions are available on the @firstclasspostcodes/js releases page.
Every version of the library is accompanied by an SRI hash file, the hash can be accessed directly using:
`sh`
$ curl https://js.firstclasspostcodes.com/plugin/v1.0.4.sri.txt # => "sha256-45tfd... sha384-43567ytr..."
You can then update the above
`
`html
`
property (an example of its usage is below).If you're running the mock service docker container. You can configure the plugin to talk to it using the example below:
`html
`Events
Whilst not necessarily required, if you need to listen to events happening we support attaching event handlers for the following:| Event Name | Description |
|:-------|:--------|
|
address | Fired when an address is selected from the drop down. Contains the address detail. |Events are fired using the CustomEvent class. Event properties are included inside the
.detail property.Event handlers can be attached using the following:
`html
`Plugin
Our plugin is built using Svelte and an instantiated component is returned from the FirstclasspostcodesPlugin()` function. Therefore, the returned object is compatible with the documented Client-side component API.