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.8 to 1.0.9

40

dist/index.js

@@ -34,22 +34,12 @@ "use strict";

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);
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;
});
if (started) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
}
}
}).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) {
closedProgramsArr.forEach(cp => {

@@ -68,2 +58,14 @@ var _a;

});
}
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 {
if (started) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
}
}
this.openedProcesses = newOpenedProcesses;

@@ -70,0 +72,0 @@ }

import {Window, windowManager} from 'node-window-manager';
import { Window, windowManager } from 'node-window-manager';
import EventEmitter from 'events';

@@ -22,3 +22,3 @@

clearEvent(){
clearEvent() {
this.eventEmitter.removeAllListeners('changed')

@@ -38,28 +38,16 @@ this.stopLoop = true;

const activeWindow = windowManager.getActiveWindow();
const processes = windowManager.getWindows();
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();
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 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];
}
}
const closedProgramsArr = this.openedProcesses.filter(x => {
return !newOpenedProcesses.find(a => a?.path === x.path)
});
if (!started) {
closedProgramsArr.forEach(cp => {

@@ -76,4 +64,19 @@ if (cp.path === this.activeWindow?.path) {

})
}
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 {
if (started) {
if (newOpenedProcesses.length) {
this.eventEmitter.emit('changed', newOpenedProcesses[0]);
this.activeWindow = newOpenedProcesses[0];
}
}
this.openedProcesses = newOpenedProcesses as Window[];

@@ -87,3 +90,3 @@ }

export function getWindows () {
export function getWindows() {
const filteredFolder = ["Windows"];

@@ -102,5 +105,5 @@

arr.push(window);
}
}
return arr;
}
{
"name": "active-window-listener",
"version": "1.0.8",
"version": "1.0.9",
"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