🔧NodeJS

Install

First, install dashcam via npm.

npm install dashcam --save

Create a Replay

Then you can trigger desktop replays programmatically like so.

const dashcam = require("dashcam");

let replay = await dashcam.createReplay({
  title: "My New Replay",
  description: `This **renders markdown** or plaintext in monospace font.`
});

Catch Application Crashes

Then, call createReplay when your application crashes.

const dashcam = require("dashcam");

process.on("uncaughtException", async (err) => {
  let replay = await dashcam.createReplay({
    title: "uncaughtException",
    description: err,
  });
  console.log("Dashcam Clip", replay);
});

setTimeout(() => {
  throw new Error("Throw makes it go boom!");
}, 3000);

Electron

const { dialog, shell } = require("electron");

const options = {
  type: "question",
  buttons: ["Yes, please", "No, thanks"],
  defaultId: 0,
  title: "Error!",
  message: "You've encountered an error!",
  detail: "Would you like to send a replay to the dev team?",
};

let res = await dialog.showMessageBox(null, options, (response) => {
  console.log(response);
});

if (res) {
  shell.openExternal("replayable://replay/create");
}

Last updated