Socket
Book a DemoInstallSign in
Socket

alt-dom-events

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

alt-dom-events

dom events support for alt

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

alt-dom-events Build Status

dom events support for alt

bindDOMEvents

Binds events fired on document to Alt actions, e.g.

import alt from './alt';
import {bindDOMEvents} from 'alt-dom-events';

class FooActions {
  constructor() {
    this.generateActions('foo', 'bar');
  }
}

export default bindDOMEvents({ 
  'foo-document-event': 'foo',
  'bar-document-event': 'bar'
}, alt.createActions(FooActions));

The following fires action FooActions.foo when foo-document-event is dispatched

document.dispatchEvent(new CustomEvent('foo-document-event', { detail: {}}));

ES7 decorator

bindDOMEvents can be used as a decorator

import alt from './alt';
import {createActions} from 'alt-utils/lib/decorators';
import {bindDOMEvents} from 'alt-dom-events';

@bindDOMEvents({
  'foo-document-event': 'foo',
  'bar-document-event': 'bar'
})
@createActions(alt)
class FooActions {
  constructor() {
    this.generateActions('foo', 'bar');
  }
}

export default FooActions;

License

MIT

Keywords

alt

FAQs

Package last updated on 06 Jan 2017

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.