npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kdeconnect

v1.0.2

Published

KDEConnect bindings for Node

Downloads

12

Readme

KDE Connect Bindings for NodeJS

Small script using DBus to allow a NodeJS application to communicate with connected devices via KDE Connect

Requirements

  • DBus support
    • NodeJS >= 10.8.0
    • Linux Desktop with DBus Support
  • KDE Connect installed and running

API

The API is written fully in Typescript, so check out the declaration file for additional infos

async getAvailableDevices()

Returns a list of KDEDevices currently known or available

class KDEDevice

Can be manually created or retrieved using getAvailableDevices

Constructor

KDEDevice(id, bus)

| Name | Type | Info | | ---- | ------------ | ----------------------------------------------------------- | | id | string | KDE ID, can be stored from old device or retrieved manually | | bus | MessageBus | optional, DBus-Session to use |

Properties

| Name | Type | Info | | ------------ | ------------------------------------- | ------------------------------------------------------- | | id | string | KDE ID | | name | string | Device Name | | type | string | smartphone | desktop | | isReachable | boolean | Is device currently reachable | | isTrusted | boolean | Is device trusted | | connectivity | {type: string, strength: number} | cellular data (not wifi) | | battery | {charge: number, charging: boolean} | battery status | | media | KDEMediaHandler | Returns a separate handler for media control. See below |

Functions

| Signature | Info | | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- | | async setup(): Promise<void> | if a device is manually created, using its KDE ID, this must be called befor use | | async shareFile(filePath: string): Promise<void> | Shares the file from file path with the device (copying it to the previously chosen folder on the device) | | async shareURL(urL: string): Promise<void> | Shares the url with the device, either as a notification or by directly opening the link | | async shareText(text: string): Promise<void> | Shares the text with the device, normally copying it into the devices clipboard | | async ring(): Promise<void> | Lets the device ring | | async ping(msg?: string): Promise | Sends a notification with an optional message to the device | |async getNotifications(): Promise<KDENotification[]>| Returns a list of notifications currently present on the device. See below | |async requestPair(): Promise | Request pairing | |async unpair(): Promise` | Unpair device |

Events

Every device has an event handler linked to it, accessible by the events Property.

| Event | Values | | ----------------------- | --------------------------------------- | | onTrustedChanged | (boolean) | | onNameChanged | (string) | | onTypeChanged | (string) | | onReachableChanged | (boolean) | | onBatteryChanged | ({charge: number, charging: boolean}) | | onConnectivityChanged | ({type: string, strength: number}) | | onConnectivityChanged | ({type: string, strength: number}) | | onPairingRequest | (KDEPairingRequest) |

class KDENotification

Constructor

Not externally accessible

Properties

| Name | Type | Info | | ----------- | ------- | --------------------------- | | appName | string | App origin name | | dismissable | boolean | Is this message dismissable | | silent | boolean | Is it a silent message | | text | string | Message text | | ticker | string | Message short version | | title | string | Message title |

Functions

| Signature | Info | | ----------------------------------- | ---------------------------------------------------------------------------------------- | | async dismiss(): Promise<boolean> | Dismisses message on device. Returns true if message is dismissable, false otherwise |

Events

No events

class KDEMediaHandler

Constructor

Not externally accessible

Properties

| Name | Type | Info | | ---------- | ------- | ---------------------------------------------------- | | length | number | length of currently playing track in ms | | position | number | already passed time of currently playing track in ms | | volume | number | device volume in % | | isPlaying | boolean | is music playing or paused | | player | string | name of currently playing app | | nowPlaying | string | name & artist of track | | title | string | track title | | artist | string | track artist name | | album | string | track album name |

Functions

| Signature | Info | | ---------------------------------- | ----------------------------------------------------- | | async Next(): Promise<void> | Play next track | | async Previous(): Promise<void> | Play previous track / Jump to start of current track | | async Play(): Promise<void> | Play track | | async Pause(): Promise<void> | Pause track | | async PlayPause(): Promise<void> | Switch Between Play/Pause | | async Stop(): Promise<void> | Stop track | | async update(): Promise<void> | Manually update data; Use to keep track of position |

Events

| Event | Values | Info | | ---------------------- | ------ | ---------------------------------------------------------------------------------------------------------- | | onMediaPlayerUpdated | () | Called when any data changes. Can fire multiple times in succession; Does NOT fire when position changes |

class KDEPairingRequest

Constructor

Not externally accessible

Properties

None

Functions

| Signature | Info | | ------------------------------- | -------------- | | async Accept(): Promise<void> | Accept request | | async Reject(): Promise<void> | Reject request |

Events

None

Do To / Not supported yet

  • Multiple Media Players
  • SFTP Bindings
  • Contacts / SMS / Telephone
  • Photo Requesting / Recieving
  • Remote Control / Keyboard
  • Remote Commands