JSPM

  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q42029F
  • License MIT

Global event delegation middleware, avoids inline events

Package Exports

  • diffhtml-middleware-synthetic-events

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 (diffhtml-middleware-synthetic-events) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

diffHTML Middleware Synthetic Events

Stable Version: 1.0.0-beta

Changes the event binding from inline event handlers like onclick = fn to use addEventListener. Hooks are attached to the body element and coordinates events using delegation.

Installation
npm install diffhtml-middleware-synthetic-events
Example
import { use } from 'diffhtml';
import syntheticEvents from 'diffhtml-middleware-synthetic-events';

use(syntheticEvents());

A good use case for this middleware is building a Chrome Extension where using inline event handlers is not possible. Supports non-bubbling events via the useCapture flag.