2.1.0 • Published 9 years ago

custom-element v2.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

custom-element

Experimental: convenience wrapper for creating custom element prototypes.

require('webcomponents.js')

var createCustom = require('custom-element')

var CustomHTMLElement = createCustom(function() {
  // created
}).on('created', function() {
  // alternative syntax for created
}).on('attached', function() {
  // attached to the DOM
}).on('detached', function() {
  // detached from the DOM
}).on('attribute', function(value) {
  // when an attribute is changed via setAttribute.
  // Note that values are coerced into strings.
})

document.registerElement('custom-element', CustomHTMLElement)