diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/auto-bind/readme.md | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/auto-bind/readme.md')
-rw-r--r-- | node_modules/auto-bind/readme.md | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/node_modules/auto-bind/readme.md b/node_modules/auto-bind/readme.md index 8c375df9c..a40bcc43a 100644 --- a/node_modules/auto-bind/readme.md +++ b/node_modules/auto-bind/readme.md @@ -6,7 +6,7 @@ ## Install ``` -$ npm install --save auto-bind +$ npm install auto-bind ``` @@ -20,6 +20,7 @@ class Unicorn { this.name = name; autoBind(this); } + message() { return `${this.name} is awesome!`; } @@ -42,7 +43,7 @@ message(); ## API -### autoBind(self) +### autoBind(self, [options]) Bind methods in `self` to their class instance. Returns the `self` object. @@ -52,6 +53,37 @@ Type: `Object` Object with methods to bind. +#### options + +Type: `Object` + +##### include + +Type: `Array<string|RegExp>` + +Bind only the given methods. + +##### exclude + +Type: `Array<string|RegExp>` + +Bind methods except for the given methods. + +### autoBind.react(self, [options]) + +Same as `autoBind`, but excludes the default [React component methods](https://reactjs.org/docs/react-component.html). + +```js +class Foo extends React.Component { + constructor(props) { + super(props); + autoBind.react(this); + } + + // … +} +``` + ## Related |