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

@area17/a17-behaviors

Package Overview
Dependencies
Maintainers
0
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@area17/a17-behaviors

JavaScript framework to attach JavaScript events and interactions to DOM Nodes

  • 0.4.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

a17-behaviors

A framework for attaching JavaScript behaviors (interactions, events, manipulations) to DOM nodes.

<button data-behavior="showAlert">Click me</button>

With a corresponding behavior:

import { createBehavior } from '@area17/a17-behaviors';

const showAlert = createBehavior('showAlert',
    {
        alert(val) {
            window.alert('Hello world!');
        }
    },
    {
        init() {
            this.$node.addEventListener('click', this.alert);
        },
        destroy() {
            this.$node.removeEventListener('click', this.alert);
        }
    }
);

export default showAlert;

This would show an alert on click of the button. Note that this.$node is the DOM node with the data-behavior attribute.

For more detailed setup and explanation, see the project wiki.

FAQs

Package last updated on 26 Nov 2024

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