How to use the screenshot-desktop.listDisplays function in screenshot-desktop

To help you get started, we’ve selected a few screenshot-desktop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web-pal / chronos-timetracker / app / renderer / sagas / screenshots.js View on Github external
reject(err);
          } else {
            if (options.filename) { // eslint-disable-line
              resolve(imgPath);
            } else {
              readAndUnlinkP(tmpPath)
                .then(resolve)
                .catch(reject);
            }
          }
        },
      );
    });
  };

  screenshot.listDisplays = function listDisplays() {
    return new Promise((resolve, reject) => {
      exec(
        `"${path.join(libPath, 'screenCapture_1.3.2.bat')}" /list`,
        {
          cwd: libPath,
        },
        (err, stdout) => {
          if (err) {
            return reject(err);
          }
          return resolve(screenshot.parseDisplaysOutput(stdout));
        },
      );
    });
  };
}
github web-pal / chronos-timetracker / app / renderer / sagas / screenshots.js View on Github external
export function* takeScreenshotRequest() {
  while (true) {
    const {
      isTest,
      time,
      timestamp,
    } = yield eff.take(actionTypes.TAKE_SCREENSHOT_REQUEST);
    try {
      yield eff.put(uiActions.setUiState({
        takeScreenshotLoading: true,
      }));
      trackMixpanel('Take screenshot request');
      const displays = yield eff.call(screenshot.listDisplays);
      const snapshotFunc = () => {
        switch (process.platform) {
          case 'darwin':
            return screenshot.darwinSnapshot;
          case 'win32':
          case 'windows':
            return screenshot.windowsSnapshot;
          default:
            return screenshot;
        }
      };
      const images = yield eff.all(
        displays.map(
          d => eff.call(
            snapshotFunc(),
            {

screenshot-desktop

Capture a screenshot of your local machine

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis