INNER CODE UNIT · JavaScript
saveHistory
cyrus-and/chrome-remote-interface · bin/client.js:102
function saveHistory() {
// only if run from a terminal
if (!process.stdin.isTTY) {
return;
}
// only store the last chunk
const entries = cdpRepl.history.slice(0, historySize).reverse().join('\n');
fs.writeFileSync(historyFile, entries + '\n');
}
// utility custom command
cdpRepl.defineCommand('target', {
help: 'Display the current target',
action: () => {
console.log(client.webSocketUrl);
cdpRepl.displayPrompt();
}
});