babel-plugin-autobind-class-methods
Advanced tools
Comparing version 1.0.4 to 2.0.0
{ | ||
"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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
49928
17
67
1
40
5