@loupedeck/core
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

@loupedeck/node

Node CI

npm version license

@loupedeck is a collection of libraries for interfacing with the various models of the Loupedeck.
Not many models are supported yet, due to lack of access to devices for testing.

Intended use

This library has nothing to do with the official loupedeck software. There is nothing here to install and run. This is a library to help developers make alternatives to that software

Install

$ npm install --save @loupedeck/node

Native dependencies

All of this library's native dependencies ship with prebuilt binaries, so having a full compiler toolchain should not be necessary to install @loupedeck/node.

API

The root methods exposed by the library are as follows. For more information it is recommended to rely on the typescript typings for hints or to browse through the source to see what methods are available

/**
 * Scan for and list detected devices
 */
export function listLoupedecks(): Promise<LoupedeckDeviceInfo[]>

/**
 * Open a loupedeck
 * @param path The path of the device to open
 * @param options Options to customise the device behvaiour
 */
export async function openLoupedeck(path: string, options?: LoupedeckDeviceOptions): Promise<LoupedeckDevice>

The Loupedeck type can be found here

Example

import { listLoupedecks, openLoupedeck } from '@loupedeck/node'

const loupedecks = await listLoupedecks()
const myLoupedeck = await openStreamDeck(loupedecks[0].path)

myLoupedeck.on('down', (info) => {
	console.log('control down', info)
})

myLoupedeck.on('up', (info) => {
	console.log('control up', info)
})

myLoupedeck.on('rotate', (info, delta) => {
	console.log('control rotate', info, delta)
})

// Fired whenever an error is detected by the device.
// Always add a listener for this event! If you don't, your application may crash if an error is reported.
myLoupedeck.on('error', (error) => {
	console.error(error)
})

// Fill the first button form the left in the first row with a solid red color. This is asynchronous.
const red = { red: 255, green: 0, blue: 0 }
await myLoupedeck.drawSolidColour('center', red, 90, 90, 0, 0)
console.log('Successfully wrote a red square to the center display.')

Some more complex demos can be found in the examples folder.

Contributing

The @loupedeck team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.

Please refer to the Changelog for project history details, too.

Package Sidebar

Install

npm i @loupedeck/core

Weekly Downloads

354

Version

1.1.2

License

MIT

Unpacked Size

115 kB

Total Files

68

Last publish

Collaborators

  • julusian