Skip to content

requireio/custom-element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Convenience wrapper for creating custom element prototypes.

Resources

Stars

Watchers

Forks

Packages

No packages published