Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

linux-xorg-screencapture

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linux-xorg-screencapture - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

examples/capture_thread.js

27

lib/XScreencap.js

@@ -11,2 +11,3 @@ const { XScreencap: XScreencap_native } = require('../build/Release/xscreencap');

this._autoCaptureStarted = false;
this._clearBacklog = true;
}

@@ -52,15 +53,17 @@

startAutoCapture(delay, monitor) {
startAutoCapture(delay, monitor, allowSkips=true) {
if (this._autoCaptureStarted) return;
this._xsc.startAutoCapture(delay, monitor, image => {
if (!this._autoCaptureStarted) return; // prevent some stray functions in the global event queue from emitting events afte rthe capture thread has been stopped
this._xsc.startAutoCapture(delay, monitor, allowSkips, image => {
if (!this._autoCaptureStarted && this._clearBacklog) return; // prevent some stray functions in the global event queue from emitting events afte rthe capture thread has been stopped
if (image.error == null) {
this.emit("image", {
data: image.data,
width: image.width,
height: image.height
});
}
setImmediate(() => {
if (image.error == null) {
this.emit("image", {
data: image.data,
width: image.width,
height: image.height
});
}
});
});

@@ -71,5 +74,7 @@

stopAutoCapture() {
stopAutoCapture(clearBacklog=true) {
if (!this._autoCaptureStarted) return;
this._clearBacklog = clearBacklog;
this._xsc.stopAutoCapture();

@@ -76,0 +81,0 @@ this._autoCaptureStarted = false;

{
"name": "linux-xorg-screencapture",
"version": "1.0.0",
"version": "1.1.0",
"description": "Captures the Linux desktop using Xorg APIs",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -75,10 +75,13 @@ # Linux Xorg Screencapture

**startAutoCapture**(delay, monitor)
**startAutoCapture**(delay, monitor, ?allowSkips)
Starts a new thread, which tries to capture the screen every `delay` milliseconds.
Image data is then emitted as an **image** event.
This method functions similar to `setInterval(() => xsc.getImageAsync().then(image => emit("image", image)), delay)`, but with the added bonus of all the timing stuff happening in native code and a separate thread, which should improve the performance. **Note**: You can only have one of these threads running at any time, so subsequent calls to `startAutoCapture` without stopping the auto capture in between have no effect.
This method functions similar to `setInterval(() => xsc.getImageAsync().then(image => emit("image", image)), delay)`, but with the added bonus of all the timing stuff happening in native code and a separate thread, which improves the performance. **Note**: You can only have one of these threads running at any time, so subsequent calls to `startAutoCapture` without stopping the auto capture in between have no effect.
The optional parameter `allowSkips` controls how the thread queues up the **image** events.
If the event did not have a chance to fire before the next image is captured, it can either be queued up (`allowSkips = false`) or just be thrown away (`allowSkips = true`, default).
**stopAutoCapture**()
**stopAutoCapture**(?clearBacklog)
Stops the auto capture thread.
No futher **image** events will be emitted after this method has been called.
By default, no futher **image** events will be emitted after this method has been called, since `clearBacklog` is `true` by default.
If you want to process every captured frame however, set `clearBacklog` to `false`.

@@ -85,0 +88,0 @@ # Events

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc