Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oui-dom-events

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oui-dom-events

DOM Utils of OneUI

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
decreased by-57.14%
Maintainers
4
Weekly downloads
 
Created
Source

oui-dom-events Build Status npm version

DOM events manager with namespace support

Installation

npm install oui-dom-events

Usage

.on(element, eventName, fn)

Bind fn to be called when eventName is triggered on element

import E from 'oui-dom-events'

let el = document.querySelector('div');
let fn = function() { /*...*/ }

E.on(el, 'click', fn);

// bind with namespace
E.on(el, 'click.slider', fn);

.off(element, eventName)

Remove all event callbacks bing called when eventName is triggered on element

E.off(el, 'click');

// unbind with namespace
E.off(el, 'click.slider');

.off(element, eventName, fn)

Remove fn from being called when eventName is triggered on element

// this also unbind events with namespace
E.off(el, 'click', fn);

// only unbind fn with namespace
E.off(el, 'click.slider', fn);

.delegate(element, selector, eventName, fn)

Delegate fn to be called when eventName is triggered on all elements that match selector under element

E.delegate(el, '.item', 'click', fn);

// delegate with namespace
E.delegate(el, '.item', 'click.slider', fn);

.undelegate(element, selector, eventName, fn)

Delegate fn to be called when eventName is triggered on all elements that match selector under element

E.undelegate(el, '.item', 'click', fn);

// undelegate with namespace
E.undelegate(el, '.item', 'click.slider', fn);

E.undelegate(el, '.item', 'click.slider');

// off also unbind all delegated events
E.off(el, 'click');

.trigger(element, eventName, dataObject)

Trigger an eventName with dataObject on element

E.trigger(el, 'click', {key1: 'data1'})

Caveats

  • mouseenter doesn't bubble, use mouseover and mouseout instead.

Liscense

MIT

Keywords

FAQs

Package last updated on 14 Jun 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc