UNPKG

noty

Version:

Noty is a dependency-free notification library that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog. Each notification is added to a queue. (Optional)

17 lines (14 loc) 486 B
import * as Utils from 'utils' export class NotyButton { constructor (html, classes, cb, attributes = {}) { this.dom = document.createElement('button') this.dom.innerHTML = html this.id = (attributes.id = attributes.id || Utils.generateID('button')) this.cb = cb Object.keys(attributes).forEach(propertyName => { this.dom.setAttribute(propertyName, attributes[propertyName]) }) Utils.addClass(this.dom, classes || 'noty_btn') return this } }