Skip to content

Commit

Permalink
fix REPL tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Oct 11, 2024
1 parent d3e5772 commit 14d1018
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/components/Interpreter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@ const replReady = () => {

// monkey patch keymap added by LIPS terminal
function trackCommands(term: JQueryTerminal) {
const _paq = globalThis._paq as PiwikTrack
let command: string;
term.option('onCommandChange', (cmd: string) => {
command = cmd;
});
const ENTER = term.cmd().keymap('ENTER');
term.cmd().keymap('ENTER', function(e: KeyboardEvent, orig: () => any) {
const _paq = globalThis._paq as PiwikTrack;
_paq.push(['trackEvent', 'REPL', 'command', command]);
return ENTER(e, orig);
});
}

export default function Interpreter(): JSX.Element {
const _paq = globalThis._paq as PiwikTrack
const [activeSnippet, setActiveSnippet] = useState(0);
const [size, setSize] = useState(1);
const ref = useRef<HTMLDivElement>();
Expand Down Expand Up @@ -71,6 +70,7 @@ export default function Interpreter(): JSX.Element {
}, []);

function execSnippet(selector = '.example:visible') {
const _paq = globalThis._paq as PiwikTrack;
const $ = globalThis.jQuery;
const $snippet = $(selector);
const code = $snippet.text();
Expand Down

0 comments on commit 14d1018

Please sign in to comment.