1.1.1 • Published 3 months ago

@diablosnaps/rpc v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@diablosnaps/rpc

Provides an RPC client to access the app locally (browser/node.js). A live demo can be found here.

Usage

import { RPCClient, TransportError, TransportErrorCode } from '@diablosnaps/rpc';

const client = new RPCClient();
try {
    await client.connect();
} catch (error) {
    if (error instanceof TransportError && error.code === TransportErrorCode.ConnectionError) {
        // App is either not running or not installed
        // > Show a message to the user
        // Use `RPCClient.start()` or `RPCClient.download()`
    }
}

const info = await client.getInfo();
// => { appVersion: '1.4.0', ... }

const tags = await client.getBackpackTags();
// => [{ id: '0123456789', name: 'Mule#1' }, ...]

const { hits, hasMore } = await client.getBackpackItems({
    page: 1,
    search: 'core',
    // tags: ['0123456789']
});

const image = await client.getBackpackImage({
    id: hits[0].id
});
// { dataURL: '...' }

Installation

npm install @diablosnaps/rpc
# or yarn
yarn add @diablosnaps/rpc
1.1.1

3 months ago

1.1.0

3 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago