lac-api
v0.1.11
Published
Helpers to interact with the Local Area Clipboard server ([`lac-run`](https://github.com/vdegenne/lac-monorepo/tree/main/packages/run))
Readme
lac-api
Helpers to interact with the Local Area Clipboard server (lac-run)
Usage
Initialize
import {Lac} from 'lac-api'
const clipboard = new Lac({
host: '192.168.x.x', // IP of the machine running `lac-run`
})Set content
lac.set('hello world') // promisifiedGet content
const content = await lac.get()
console.log(content) // hello worldWebSocket
import {LacWS} from 'lac-api'
const clipboard = new LacWS({
host: '192.168.x.x', // IP of the machine running `lac-run`
})
// listen for changes
clipboard.subscribe((value) => {
console.log(`Content changed: "${value}"`)
})
// modify the content (sent over the WS connection)
clipboard.set('hello world')
// when you're done
clipboard.disconnect()