()
| 46 | } |
| 47 | |
| 48 | componentDidMount(): void { |
| 49 | const nodeModel = this.props.nodeModel; |
| 50 | const childrenKey = this.props.options.children || 'children'; |
| 51 | |
| 52 | const triggerChange = debounce(20, (...args) => { |
| 53 | if (this.isDeconstructed) return; |
| 54 | this.handleSelectChange.apply(this, args); |
| 55 | }); |
| 56 | |
| 57 | this.loadHandler = this.enhanceLoad(nodeModel); |
| 58 | this.watchers = { |
| 59 | [this.idGen.next()]: watchPropertyChange( |
| 60 | nodeModel, |
| 61 | 'indeterminate', |
| 62 | value => { |
| 63 | triggerChange(nodeModel.checked, value); |
| 64 | } |
| 65 | ), |
| 66 | [this.idGen.next()]: watchPropertyChange(nodeModel, 'checked', value => { |
| 67 | triggerChange(value, nodeModel.indeterminate); |
| 68 | }), |
| 69 | [this.idGen.next()]: watchPropertyChange(nodeModel, 'loading', () => { |
| 70 | this.setState({}); |
| 71 | }) |
| 72 | }; |
| 73 | |
| 74 | if (nodeModel.data != null) { |
| 75 | this.watchers[ |
| 76 | this.idGen.next() |
| 77 | ] = watchPropertyChange(nodeModel.data, childrenKey, () => { |
| 78 | nodeModel.updateChildren(); |
| 79 | this.setState({}); //force update view |
| 80 | }); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | componentWillUnmount(): void { |
| 85 | this.loadHandler(); |
nothing calls this directly
no test coverage detected