Socket
Book a DemoInstallSign in
Socket

custom-element

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-element

Light wrapper for creating custom element prototypes

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
3
Created
Source

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)

Keywords

custom

FAQs

Package last updated on 26 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts