JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1316
  • Score
    100M100P100Q115097F
  • License Apache-2.0

Mixin that support event targets retargeting so the element listens on a set node instead of default one

Package Exports

  • @advanced-rest-client/events-target-mixin
  • @advanced-rest-client/events-target-mixin/events-target-mixin.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@advanced-rest-client/events-target-mixin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Published on NPM

Build Status

A Mixin that support event targets retargeting so the element listens on a set node instead of default one (window).

API components

This components is a part of API components ecosystem

Usage

Installation

npm install --save @advanced-rest-client/events-target-mixin

In a web component

import { LitElement, html } from 'lit-element';
import { EventsTargetMixin } '@advanced-rest-client/events-target-mixin/events-target-mixin.js';

class SampleElement extends EventsTargetMixin(HTMLElement) {
  _attachListeners(node) {
    node.addEventListener('my-event', this._testEventHandler);
  }

  _detachListeners(node) {
    node.removeEventListener('my-event', this._testEventHandler);
  }

  _testEventHandler() {

  }
}
customElements.define('sample-element', SampleElement);
<sample-element id="example"></sample-element>
<div id="target"></div>
example.eventsTarget = target;

The element listens for events that bubbles through #target element.

Development

git clone https://github.com/advanced-rest-client/events-target-mixin
cd events-target-mixin
npm install

Running the tests

npm test