Skip to content

Commit

Permalink
Add setBusy method to block command input programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
snowak-cb committed Aug 2, 2017
1 parent 72cdc93 commit e509c58
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Properties you can pass to the console element
| 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}`.
| logTable | (tableObject: Object[, type: string])=>void | Log tabular data to the console. `tableObject` has the format `{ headers: ['header 1', 'header 2'], rows: [['row 1, col 1', 'row 1, col 2'], ['row 2, col 1', 'row 2, col 2']]}`. `headers` is optional. Rows can also contain objects which will be output as JSON strings or according to the `type: link` rules listed above. The optional `type` argument will be handled the same as in `logX`
| return | ()=>void | Signal the current command has finished and a new prompt should be displayed.
| setBusy | ()=>void | Block user input as though a command is being handled.
| clearScreen | ()=>void | Clear the visible log in the console. Does not clear command history.


Expand Down
Binary file modified dist/dist-min.tar.gz
Binary file not shown.
Binary file modified dist/dist-min.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/dist-min/react-console.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dist-min/react-console.min.js.map

Large diffs are not rendered by default.

Binary file modified dist/dist.tar.gz
Binary file not shown.
Binary file modified dist/dist.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions dist/dist/react-console.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/dist/react-console.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/react-console.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/react-console.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/react-console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ export default class extends React.Component<ConsoleProps,ConsoleState> {
focus?: HTMLElement;
} = {};
// Command API
setBusy = () => {
this.setState({acceptInput: false});
}
updateLastLog = (...messages: any[]) => {
let log = this.state.log;
if(!log.length){
Expand Down

0 comments on commit e509c58

Please sign in to comment.