New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

active-window-listener

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active-window-listener - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

56

dist/index.js

@@ -33,20 +33,18 @@ "use strict";

return;
const processes = node_window_manager_1.windowManager.getWindows();
const newOpenedProcesses = this.processArr.map(pa => {
return processes.find(p => {
return p.path.indexOf(pa, p.path.length - pa.length) != -1;
const activeWindow = node_window_manager_1.windowManager.getActiveWindow();
if ((!this.activeWindow || this.activeWindow.processId !== activeWindow.processId) && this.processArr.find(pa => activeWindow.path.indexOf(pa, activeWindow.path.length - pa.length) != -1)) {
this.eventEmitter.emit('changed', activeWindow);
this.activeWindow = activeWindow;
}
else {
const processes = node_window_manager_1.windowManager.getWindows();
const newOpenedProcesses = this.processArr.map(pa => {
return processes.find(p => {
return p.path.indexOf(pa, p.path.length - pa.length) != -1;
});
}).filter(pa => pa);
const closedProgramsArr = this.openedProcesses.filter(x => {
return !newOpenedProcesses.find(a => (a === null || a === void 0 ? void 0 : a.path) === x.path);
});
}).filter(pa => pa);
const closedProgramsArr = this.openedProcesses.filter(x => {
return !newOpenedProcesses.find(a => (a === null || a === void 0 ? void 0 : a.path) === x.path);
});
if (started) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
}
}
closedProgramsArr.forEach(cp => {
var _a;
if (cp.path === ((_a = this.activeWindow) === null || _a === void 0 ? void 0 : _a.path)) {
if (started) {
if (newOpenedProcesses.length) {

@@ -56,13 +54,17 @@ this.eventEmitter.emit('changed', newOpenedProcesses[0]);

}
else {
this.eventEmitter.emit('changed', undefined);
this.activeWindow = undefined;
}
closedProgramsArr.forEach(cp => {
var _a;
if (cp.path === ((_a = this.activeWindow) === null || _a === void 0 ? void 0 : _a.path)) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
}
else {
this.eventEmitter.emit('changed', undefined);
this.activeWindow = undefined;
}
}
}
});
this.openedProcesses = newOpenedProcesses;
const activeWindow = node_window_manager_1.windowManager.getActiveWindow();
if ((!this.activeWindow || this.activeWindow.processId !== activeWindow.processId) && this.processArr.find(pa => activeWindow.path.indexOf(pa, activeWindow.path.length - pa.length) != -1)) {
this.eventEmitter.emit('changed', activeWindow);
this.activeWindow = activeWindow;
});
this.openedProcesses = newOpenedProcesses;
}

@@ -69,0 +71,0 @@ setTimeout(() => this.loop(), 5000);

@@ -36,41 +36,43 @@

if (this.stopLoop) return;
const processes = windowManager.getWindows();
const newOpenedProcesses = this.processArr.map(pa => {
return processes.find(p => {
return p.path.indexOf(pa, p.path.length - pa.length) != -1;
})
}).filter(pa => pa)
const closedProgramsArr = this.openedProcesses.filter(x => {
return !newOpenedProcesses.find(a => a?.path === x.path)
});
const activeWindow = windowManager.getActiveWindow();
if (started) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
}
}
if ((!this.activeWindow || this.activeWindow.processId !== activeWindow.processId) && this.processArr.find(pa => activeWindow.path.indexOf(pa, activeWindow.path.length - pa.length) != -1)) {
this.eventEmitter.emit('changed', activeWindow);
this.activeWindow = activeWindow;
} else {
const processes = windowManager.getWindows();
closedProgramsArr.forEach(cp => {
if (cp.path === this.activeWindow?.path) {
const newOpenedProcesses = this.processArr.map(pa => {
return processes.find(p => {
return p.path.indexOf(pa, p.path.length - pa.length) != -1;
})
}).filter(pa => pa)
const closedProgramsArr = this.openedProcesses.filter(x => {
return !newOpenedProcesses.find(a => a?.path === x.path)
});
if (started) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
} else {
this.eventEmitter.emit('changed', undefined);
this.activeWindow = undefined
}
}
})
this.openedProcesses = newOpenedProcesses as Window[];
const activeWindow = windowManager.getActiveWindow();
if ((!this.activeWindow || this.activeWindow.processId !== activeWindow.processId) && this.processArr.find(pa => activeWindow.path.indexOf(pa, activeWindow.path.length - pa.length) != -1)) {
this.eventEmitter.emit('changed', activeWindow);
this.activeWindow = activeWindow;
closedProgramsArr.forEach(cp => {
if (cp.path === this.activeWindow?.path) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
} else {
this.eventEmitter.emit('changed', undefined);
this.activeWindow = undefined
}
}
})
this.openedProcesses = newOpenedProcesses as Window[];
}

@@ -77,0 +79,0 @@

{
"name": "active-window-listener",
"version": "1.0.7",
"version": "1.0.8",
"description": "Listen to active windows by specifying them",

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

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