Socket
Socket
Sign inDemoInstall

babel-plugin-autobind-class-methods

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 2.0.0

.babelrc

28

package.json
{
"name": "babel-plugin-autobind-class-methods",
"version": "1.0.4",
"version": "2.0.0",
"description": "Babel plugin that binds every class method to \"this\" with hot reload support",
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"clean": "rm -rf lib",
"build": "babel src -d lib",
"example": "npm run build && babel example/input.js -o example/output.js",
"test": "mocha --compilers js:babel-register",
"test:watch": "npm run test -- --watch",
"prepublish": "npm run clean && npm run build"
},

@@ -13,2 +18,6 @@ "repository": {

},
"bugs": {
"url": "https://github.com/UgnisSoftware/babel-plugin-autobind-class-methods/issues"
},
"homepage": "https://github.com/UgnisSoftware/babel-plugin-autobind-class-methods#readme",
"keywords": [

@@ -21,2 +30,4 @@ "Babel",

"arrow",
"react",
"method",
"property"

@@ -26,6 +37,9 @@ ],

"license": "MIT",
"bugs": {
"url": "https://github.com/UgnisSoftware/babel-plugin-autobind-class-methods/issues"
},
"homepage": "https://github.com/UgnisSoftware/babel-plugin-autobind-class-methods#readme"
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-helper-plugin-test-runner": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"mocha": "^2.4.5"
}
}

@@ -1,7 +0,7 @@

# babel-plugin-autobind-class-methods
Autobinds "this" to class methods, works with hot reloading, created to be used with React
# babel-plugin-autobind-class-methods v2.0.0
Autobinds "this" to class methods and works with hot reloading.
Requires React Hot Loader 3
Compatible with the latest React Hot Loader 3-beta
Install:
## Installation
```

@@ -15,4 +15,27 @@ npm install babel-plugin-autobind-class-methods --save-dev

"presets": ["es2015", "react"],
"plugins": ["autobind-class-methods", "react-hot-loader/babel"]
"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
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • 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