Skip to content

Commit 1041f45

Browse files
author
jonatansalas
committed
Initial commit
1 parent 0c41c7f commit 1041f45

File tree

6 files changed

+3775
-0
lines changed

6 files changed

+3775
-0
lines changed

.babelrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"plugins": [
3+
[
4+
"transform-react-jsx",
5+
{
6+
"pragma": "h"
7+
}
8+
],
9+
"transform-class-properties",
10+
"transform-es2015-modules-commonjs"
11+
]
12+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
.idea
3+
node_modules

index.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {h, mount, Component, Text} from 'ink';
2+
3+
class Counter extends Component {
4+
constructor() {
5+
super();
6+
this.state = {
7+
index: 0
8+
};
9+
}
10+
11+
componentDidMount() {
12+
this.timer = this.createIntervalUpdater();
13+
}
14+
15+
render(props, state) {
16+
return (
17+
<Text green>
18+
{state.index} tests passed
19+
</Text>
20+
);
21+
}
22+
23+
componentWillUnmount() {
24+
clearInterval(this.timer);
25+
}
26+
27+
createIntervalUpdater = () => setInterval(() => this.setState({ index: this.state.index + 1 }), 100);
28+
}
29+
30+
mount(<Counter/>, process.stdout);

0 commit comments

Comments
 (0)