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

@todesktop/client-ipc

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@todesktop/client-ipc - npm Package Compare versions

Comparing version

to
0.6.0

2

package.json
{
"name": "@todesktop/client-ipc",
"version": "0.5.0",
"version": "0.6.0",
"description": "",

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

@@ -11,3 +11,3 @@ - [ToDesktop Client IPC](#todesktop-client-ipc)

This is a zero-dependency package for interacting with [@todesktop/plugin-ipc](https://www.npmjs.com/package/@todesktop/plugin-ipc). This package exposes a set of functions for getting metadata about the active window.
This is a zero-dependency package for interacting with [@todesktop/plugin-ipc](https://www.npmjs.com/package/@todesktop/plugin-ipc). This package exposes a set of functions for communicating between windows.

@@ -27,32 +27,52 @@

Get metadata about the active window (title, id, bounds, owner, etc).
### subscribe
Subscribes to a messaging channel and executes a callback when that message is triggered. The callback contains the `data` and `context` information from the sender.
You can also `unsubscribe` from a messaging channel by executing the function that is returned from the initial `subscribe` call.
```js
import { getActiveWin } from "@todesktop/client-ipc";
import { subscribe } from "@todesktop/client-ipc";
const unsubscribe = subscribe("foo", (data, context) => {
console.log({ data, context });
/**
* {
* data: { msg: "bar" },
* context: { windowId: 2, viewId: 2 }
* }
*/
});
// ...later
unsubscribe();
```
### publish
Publishes data to a messaging channel.
```js
import { publish } from "@todesktop/client-ipc";
publish("foo", { msg: "bar" });
```
### identify
Retrieves id information about the window and view.
```js
import { identify } from "@todesktop/client-ipc";
(async () => {
console.log(await getActiveWin(options));
/*
{
bounds: {
x: 720,
y: 330,
height: 600,
width: 800
},
id: 7184,
memoryUsage: 1248,
owner: {
name: 'Simple App',
processId: 56614,
bundleId: 'com.google.Chrome',
path: '/Applications/Google Chrome.app'
},
platform: "macos",
title: 'Google',
}
*/
})();
console.log(await identify())
/**
* {
* windowId: 1,
* viewId: 1
* }
*/
})
```
## Architecture

@@ -59,0 +79,0 @@