1.4.5 • Published 6 months ago

@types/lgtv2 v1.4.5

Weekly downloads
23
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/lgtv2

Summary

This package contains type definitions for lgtv2 (https://github.com/hobbyquaker/lgtv2).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/lgtv2.

index.d.ts

// Type definitions for lgtv2 1.4
// Project: https://github.com/hobbyquaker/lgtv2
// Definitions by: Ovidiu Pruteanu <https://github.com/ovidiupruteanu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.6

/// <reference types="node" />

import { EventEmitter } from 'events';

declare namespace LGTV {
    interface SpecializedSocket {
        send(type: string, payload?: any): void;

        close(): void;
    }

    interface Config {
        url?: string | undefined;
        timeout?: number | undefined;
        reconnect?: number | undefined;
        keyFile?: string | undefined;
        clientKey?: string | undefined;
        saveKey?: ((key: string, callback: (error?: NodeJS.ErrnoException | null) => void) => void) | undefined;
    }
}

declare function LGTV(config?: LGTV.Config): LGTV;

declare class LGTV extends EventEmitter {
    constructor(config?: LGTV.Config);

    clientKey: string;

    private register(): void;

    connect(host: string): void;

    disconnect(): void;

    private send(type: string, uri: string, callback: (error: Error | null, result: any) => void): void;
    private send(type: string, uri: string, payload?: any, callback?: (error: Error | null, result: any) => void): void;

    getSocket(url: string, callback: (error: Error | null, socket: LGTV.SpecializedSocket) => void): void;

    request(uri: string, callback: (error: Error | null, result: any) => void): void;
    request(uri: string, payload?: any, callback?: (error: Error | null, result: any) => void): void;

    subscribe(uri: string, callback: (error: Error | null, result: any) => void): void;
    subscribe(uri: string, payload?: any, callback?: (error: Error | null, result: any) => void): void;

    on(event: 'connecting', listener: (host: string) => void): this;
    on(event: 'connect' | 'prompt', listener: () => void): this;
    on(event: 'error', listener: (error: Error) => void): this;
    on(event: 'close', listener: (hadError: boolean) => void): this;
}

export = LGTV;

Additional Details

  • Last updated: Thu, 08 Jul 2021 16:23:43 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Ovidiu Pruteanu.

1.4.5

6 months ago

1.4.4

7 months ago

1.4.3

9 months ago

1.4.2

3 years ago

1.4.1

4 years ago

1.4.0

4 years ago