Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

custom-element

Package Overview
Dependencies
Maintainers
1
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

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
13
-35%
Maintainers
1
Weekly downloads
 
Created
Source

custom-element

Experimental: convenience wrapper for creating custom element prototypes.

require('polyfill-webcomponents')

var createCustom = require('custom-element')

var CustomHTMLElement = createCustom(function() {
  // created
}).when('created', function() {
  // alternative syntax for created
}).when('attach', function() {
  // attached to the DOM
}).when('detach', function() {
  // detached from the DOM
}).when('attribute', function(value) {
  // when an attribute is changed via setAttribute.
  // Note that values are coerced into strings.
}).bind('title', function(value, before) {
  // listen to changes in attributes bound using
  // template interpolation, e.g.:
  //
  // <template bind>
  //   <custom-element title="{{post.title}}">
  // </template>
  //
  // This will get called whenever post.title changes.
  // Note that this is not called when initiating
  // the element with template.model = {}
})

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

Keywords

custom

FAQs

Package last updated on 26 Jun 2014

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