Skip to content

Commit

Permalink
Add clearScreen method
Browse files Browse the repository at this point in the history
  • Loading branch information
snowak-cb committed May 22, 2017
1 parent 0d5d083 commit 524e795
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Properties you can pass to the console element
| log | (...messages: any)=>void | Log messages to the console. If string, print the value, otherwise, print the JSON value of the message.
| logX | (type: string, ...messages: any)=>void | Log messages of a particular type to the console. The messages will be given the class `react-console-message-{type}`.
| return | ()=>void | Signal the current command has finished and a new prompt should be displayed.
| clearScreen | ()=>void | Clear the visible log in the console. Does not clear command history.


## Awknoledgements
Expand Down
7 changes: 5 additions & 2 deletions src/react-console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ export default class extends React.Component<ConsoleProps,ConsoleState> {
70: this.forwardChar,
// C-b
66: this.backwardChar,
// C-l TODO
//76: this.clearScreen,
// C-l
76: this.clearScreen,
// C-p
80: this.previousHistory,
// C-n
Expand Down Expand Up @@ -588,6 +588,9 @@ export default class extends React.Component<ConsoleProps,ConsoleState> {
}, this.scrollToBottom);
}
}
clearScreen = () => {
this.setState({ log: [] });
}
nonIncrementalReverseSearchHistory = () => {
// TODO
}
Expand Down

0 comments on commit 524e795

Please sign in to comment.