5.0.1 • Published 7 years ago

babel-plugin-autobind-class-methods v5.0.1

Weekly downloads
731
License
MIT
Repository
github
Last release
7 years ago

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
5.0.1

7 years ago

4.1.1

7 years ago

4.2.0

7 years ago

4.1.0

7 years ago

4.0.0

7 years ago

3.0.0

7 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago