(num, callback)
| 20 | console.timeEnd('Counter mount') |
| 21 | }, |
| 22 | toNum(num, callback) { |
| 23 | cancelAnimationFrame(this.rid) |
| 24 | let { COUNT } = this.props |
| 25 | let counting = () => { |
| 26 | let { count } = this.props |
| 27 | switch (true) { |
| 28 | case count > num: |
| 29 | COUNT('DECREMENT') |
| 30 | break |
| 31 | case count < num: |
| 32 | COUNT('INCREMENT') |
| 33 | break |
| 34 | case count === num: |
| 35 | return callback && callback() |
| 36 | } |
| 37 | this.rid = requestAnimationFrame(counting) |
| 38 | } |
| 39 | counting() |
| 40 | }, |
| 41 | componentWillUpdate() { |
| 42 | // debugger |
| 43 | console.log('willUpdate', 'Counter') |
nothing calls this directly
no test coverage detected