开发者社区> 镜像站> NPM> custom-element
custom-element
Light wrapper for creating custom element prototypes
Last updated 6 years ago by timoxley .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install custom-element 
SYNC missed versions from official npm registry.

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)

Current Tags

  • 2.1.0                                ...           latest (6 years ago)

3 Versions

  • 2.1.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Downloads
Today 0
This Week 2
This Month 2
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (7)