@types/node-pixel
TypeScript icon, indicating that this package has built-in type declarations

0.11.2 • Public • Published

Installation

npm install --save @types/node-pixel

Summary

This package contains type definitions for node-pixel (https://github.com/ajfisher/node-pixel#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-pixel.

index.d.ts

import { Board } from "johnny-five";
export {};

// Opaque types typings
declare const tag: unique symbol;
interface TagContainer<Token> {
    readonly [tag]: Token;
}
type Opaque<Type, Token = unknown> = Type & TagContainer<Token>;

// Lib typings
export const BACKWARD: Opaque<number, "ShiftDirection">;
export const FORWARD: Opaque<number, "ShiftDirection">;
export type Direction = typeof BACKWARD | typeof FORWARD;

export namespace COLOR_ORDER {
    const GRB: Opaque<number, "ColorOrder">;
    const RGB: Opaque<number, "ColorOrder">;
    const BRG: Opaque<number, "ColorOrder">;
}

export interface StripArgs {
    board: Board;
    strips: Array<{ pin: string | number; length: number }> | number[];
    controller?: "FIRMATA" | "I2CBACKPACK";
    color_order?: typeof COLOR_ORDER.GRB | typeof COLOR_ORDER.RGB | typeof COLOR_ORDER.BRG;
    gamma?: number;
}

export class Strip {
    readonly length: number;

    constructor(args: StripArgs);

    pixel(index: number): Pixel;
    shift(index: number, direction: Direction, wrap: boolean): void;
    color(color: string | number[]): void;
    colour(color: string | number[]): void;
    off(): void;
    clear(): void;
    show(): void;

    on(event: string, callback: () => void): void;
    on(event: "error", callback: (e: Error) => void): void;
}

export interface Pixel {
    color(color: string | number[]): void;
    colour(color: string | number[]): void;
    off(): void;
    clear(): void;
}

Additional Details

Credits

These definitions were written by Andréas "ScreamZ" HANSS.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/node-pixel

Weekly Downloads

5

Version

0.11.2

License

MIT

Unpacked Size

5.6 kB

Total Files

5

Last publish

Collaborators

  • types