Skip to content

Repository files navigation

aw-client-js

Client library for ActivityWatch in TypeScript/JavaScript.

Build StatusnpmKnown Vulnerabilities

Install

npm install aw-client

Usage

The library uses Promises for almost everything, so either use .then() or async/await syntax.

The example below is written with .then() to make it easy to run in the node REPL.

const{ AWClient }=require('aw-client');constclient=newAWClient('test-client')// Get server infoclient.getInfo().then(console.log);// List bucketsclient.getBuckets().then(console.log);// Create bucketconstbucketId="test";client.createBucket(bucketId,"bucket-type","your-hostname");// Send a heartbeatconstnowStr=(newDate()).toISOString();constheartbeat={timestamp: nowStr,duration: 0,data: {label: "just testing!"}};client.heartbeat(bucketId,5,heartbeat);

Contribute

Setup your dev environment

npm install

Build the library

npm run compile

Run the tests

npm test

About

Client library for ActivityWatch in JavaScript

Topics

Resources

Stars

40 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages