Skip to content

Commit

Permalink
use the API on page load
Browse files Browse the repository at this point in the history
  • Loading branch information
mostthingsweb committed May 13, 2024
1 parent 27a5f37 commit 2b1daf0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/JQueryTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export const JQueryTerminal: React.ForwardRefExoticComponent<React.PropsWithoutR
setPrompt: (prompt) => {
terminalObjectRef.current?.set_prompt(prompt);
},
exec: (str: string) => {
terminalObjectRef.current?.exec(str);
},
setInterpreter: (interpreter?: TypeOrArray<JQueryTerminal.Interpreter>) => {
if (terminalObjectRef.current) {
terminalObjectRef.current.set_interpreter(interpreter);
Expand Down
8 changes: 8 additions & 0 deletions src/components/PlaygroundTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ export const PlaygroundTerminal: React.FC = () => {

terminalRef.current.echo("Ready :)\n");
terminalRef.current.setPrompt(">>> ");
terminalRef.current.exec("d = DataSmart()")
terminalRef.current.exec(`d.setVar('P', 'Are you \${MOD} \${ADJ}')`);
terminalRef.current.exec(`d.setVar('MOD', 'not')`);
terminalRef.current.exec(`d.setVar('ADJ', 'enter')`);
terminalRef.current.exec(`d.setVar('ADJ:append', 'tained')`);
terminalRef.current.exec(`d.setVar('P:append', '?')`);
terminalRef.current.exec(`print(d.expand("\${P}"))`);

terminalRef.current.freeze(false);
}
break;
Expand Down

0 comments on commit 2b1daf0

Please sign in to comment.