dgtek-test-address
v1.0.7
Published
For DGTek resellers only
Downloads
10
Maintainers
Readme
dgtek-test-address
How to install
npm install dgtek-test-address --save
How to use
First of all require package
const TestAddress = require('dgtek-test-address')
or
import TestAddress from 'dgtek-test-address'
Then create input element or use existing one (DOM element)
const inputAddress = document.getElementById('input-address')
This element (inputAddress in this example) will receive events
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:
address
string
type
string ('available', 'build', 'notAvailable')
Callback function
function catchEvent (event) {
console.log(event.type)
console.log(event.address)
}
Now you are ready to start
const testAddress = new TestAddress({ input: inputAddress })