Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

babel-plugin-autobind-class-methods

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Issues
File Explorer

Advanced tools

babel-plugin-autobind-class-methods

Babel plugin that binds every class method to "this" with hot reload support

    5.0.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
745
decreased by-10.78%

Weekly downloads

Readme

Source

babel-plugin-autobind-class-methods

Autobinds "this" to class methods and works with hot reloading.

Compatible with the latest React Hot Loader 3-beta

Installation

npm install babel-plugin-autobind-class-methods --save-dev

Example .babelrc:

{ "presets": ["es2015", "react"], "plugins": ["autobind-class-methods"] }

What it does

Example code:

class Example { constructor(){ this.greeting = 'Hello' } greet(){ console.log(this.greeting) } render(){ setTimeout(this.greet, 0) } } const example = new Example() example.render() // logs out 'Hello', in vanilla js it would log out undefined

Keywords

FAQs

Last updated on 02 Feb 2017

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc