MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / toNum

Function toNum

examples/simple/index.js:22–40  ·  view source on GitHub ↗
(num, callback)

Source from the content-addressed store, hash-verified

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')

Callers

nothing calls this directly

Calls 1

countingFunction · 0.70

Tested by

no test coverage detected