File tree 7 files changed +2257
-2
lines changed
7 files changed +2257
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : API
3
+ route : /api
4
+ ---
5
+
6
+ # API
7
+
8
+ | Name | Type | Description |
9
+ | ------------- | ------------- | ------------- |
10
+ | children | object (required) | Define your react component here |
11
+ | start | number (required) | A start value for the timer |
12
+ | end | function (required) | A function which determines the end for the timer |
13
+ | interval | number | An interval value for the timer. Default is 1 second |
14
+ | onTick | function (required) | A callback function where the next computed value is determined |
15
+ | onEnd | function | A callback function which executes when the timer stops executing |
16
+ ---
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Introduction
3
+ route : /
4
+ ---
5
+
6
+ # Introduction
7
+
8
+ > A minimalistic yet customizable timer component!
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Playground
3
+ route : /playground
4
+ ---
5
+
6
+ # Playground
7
+
8
+ import { Playground } from ' docz'
9
+ import ReactTimer from ' ../src/index'
10
+
11
+ ## Incremental timer
12
+
13
+ <Playground >
14
+ <ReactTimer
15
+ start = { 0 }
16
+ end = { (value ) => value === 30 }
17
+ onEnd = { (value ) => console .log (' ENDED WITH VALUE' , value )}
18
+ onTick = { (value ) => value + 1 }
19
+ >
20
+ { (time ) => <div >{ time } </div >}
21
+ </ReactTimer >
22
+ </Playground >
23
+
24
+ ## Decremental timer
25
+
26
+ <Playground >
27
+ <ReactTimer
28
+ start = { 30 }
29
+ end = { (value ) => value < 25 }
30
+ onEnd = { (value ) => console .log (' ENDED WITH VALUE' , value )}
31
+ onTick = { (value ) => value - 1 }
32
+ >
33
+ { (time ) => <div >{ time } </div >}
34
+ </ReactTimer >
35
+ </Playground >
36
+
37
+ ## Infinite timer
38
+
39
+ <Playground >
40
+ <ReactTimer
41
+ start = { 0 }
42
+ end = { () => false }
43
+ onEnd = { (value ) => console .log (' ENDED WITH VALUE' , value )}
44
+ onTick = { (value ) => value + 1 }
45
+ >
46
+ { (time ) => <div >{ time } </div >}
47
+ </ReactTimer >
48
+ </Playground >
49
+
50
+ ## Basic Clock
51
+
52
+ <Playground >
53
+ <ReactTimer
54
+ start = { 0 }
55
+ end = { () => false }
56
+ onEnd = { (value ) => console .log (' ENDED WITH VALUE' , value )}
57
+ onTick = { (value ) => value + 1 }
58
+ >
59
+ { () => (new Date ()).toString ()}
60
+ </ReactTimer >
61
+ </Playground >
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ base : '/react-timer/' ,
3
+ title : 'React Timer' ,
4
+ hashRouter : true ,
5
+ ignore : [ 'readme.md' ] ,
6
+ src : './docs'
7
+ }
You can’t perform that action at this time.
0 commit comments