2.0.1 • Published 1 year ago

as-custom-element v2.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
1 year ago

As Custom Element

The easiest way to add Custom Elements like callbacks to any node.

Compatible with modern browsers, as well as IE11, and no polyfills are needed, for a minified size less than 0.8K.

import {upgrade, downgrade} from 'as-custom-element';

const someBehavior = {
  // lifecycle callbacks
  connectedCallback() {
    console.log(this, 'is connected');
  },
  disconnectedCallback() {},

  // attributes related helpers
  observedAttributes: ['one', 'or', 'more'],
  attributeChangedCallback(attributeName, oldValue, newValue) {}
};

upgrade(document.querySelector('#any'), someBehavior);

// to drop the behavior at any time
downgrade(document.querySelector('#any'), someBehavior);
2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

3 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.0

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.3.2

4 years ago

0.2.3

4 years ago

0.3.1

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago