1 | 'use strict';
|
2 | const autoBind = require('.');
|
3 |
|
4 | const excludedReactMethods = [
|
5 | 'componentWillMount',
|
6 | 'UNSAFE_componentWillMount',
|
7 | 'render',
|
8 | 'getSnapshotBeforeUpdate',
|
9 | 'componentDidMount',
|
10 | 'componentWillReceiveProps',
|
11 | 'UNSAFE_componentWillReceiveProps',
|
12 | 'shouldComponentUpdate',
|
13 | 'componentWillUpdate',
|
14 | 'UNSAFE_componentWillUpdate',
|
15 | 'componentDidUpdate',
|
16 | 'componentWillUnmount',
|
17 | 'componentDidCatch',
|
18 | 'setState',
|
19 | 'forceUpdate'
|
20 | ];
|
21 |
|
22 | module.exports = (self, {exclude = [], ...options} = {}) => {
|
23 | options.exclude = [
|
24 | ...exclude,
|
25 | ...excludedReactMethods
|
26 | ];
|
27 |
|
28 | return autoBind(self, options);
|
29 | };
|