npm install dgtek-test-address --save
const TestAddress = require('dgtek-test-address')
or
import TestAddress from 'dgtek-test-address'
const inputAddress = document.getElementById('input-address')
This element (inputAddress in this example) will receive events
You should catch events of input element:
inputAddress.addEventListener('available', catchEvent)
inputAddress.addEventListener('build', catchEvent)
inputAddress.addEventListener('notAvailable', catchEvent)
Callback function (catchEvent in this example) will receive event object
This object contain two properties:
string
string ('available', 'build', 'notAvailable')
function catchEvent (event) {
console.log(event.type)
console.log(event.address)
}
const testAddress = new TestAddress({ input: inputAddress })