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

fruitmachine-ftdomdelegate

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fruitmachine-ftdomdelegate

A [ftdomdelegate](http://github.com/ftlabs/ftdomdelegate) [FruitMachine](http://github.com/ftlabs/fruitmachine) helper.

  • 2.2.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
441
increased by57.5%
Maintainers
5
Weekly downloads
 
Created
Source

fruitmachine-ftdomdelegate Build Status

A ftdomdelegate FruitMachine helper.

This helper:

  • Instantiates the dom-delegate when a fruitmachine module is instantiated;
  • Binds that dom-delegate to the module's El when the fruitmachine module is setup;
  • Unbinds the dom-delegate instance from the El when the fruitmachine module fires its teardown event;
  • And destroys the dom-delegate when the fruitmachine module is destroyed.

Usage examples

var Apple = fruitmachine.define({
  name: 'apple',
  helpers: [require('fruitmachine-ftdomdelegate')],
  initialize: function() {
    this.onButtonClick = this.onButtonClick.bind(this);
  },
  setup: function() {
    this.delegate.on('click', 'button', this.onButtonClick);
  },
  onButtonClick: function() {
    this.fire('buttonclick');
  }
});

Note: as long as you properly destroy your fruitmachine modules after you're finished with them, you need not worry about detached DOM nodes because dom-delegate will ensure any event listeners added are removed when destroy is called on it.

Demonstration 'todo' app

There is a rework of the TODO example from the main fruitmachine project.

The modules that make use of the fruitmachine-ftdomdelegate helper are located here and here.

Installation

$ npm install fruitmachine-ftdomdelegate

Tests

$ npm install
$ npm test

Credits and collaboration

The lead developer of fruitmachine-ftdomdelegate is @matthew-andrews at FT Labs. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.

FAQs

Package last updated on 01 Oct 2018

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