Nimble Porridge Muncher

    httpgd
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.7 • Public • Published

    R httpgd GraphicsDevice API and connection handler

    API and connection handler to connect with R httpgd servers.

    Features

    • Simplify httpgd server access from JavaScript
    • Full TypeScript type definitions
    • Automatic WebSocket connection with polling fallback and reconnection

    Usage

    Base usage

    Minimal example how to listen for server side changes:

    import { Httpgd } from 'httpgd';
    
    const httpgd = new Httpgd('127.0.0.1:1234', 'mytoken', true);
    httpgd.onPlotsChanged((newState) => console.log(newState));
    httpgd.connect();
    
    // httpgd.removePlot(...)
    // httpgd.getPlotURL(...)

    Advanced usage example: The client included in the httpgd R package.

    Direct API access

    In applications where there is no need to continuously listen for server side changes, httpgd APIs can also be called directly using the api module.

    Example:

    import { url_plot } from 'httpgd/lib/api';
    
    const url = url_plot({ host: '127.0.0.1:1234' }, { id: 'myPlotId' });
    document.getElementsByTagName('img')[0].src = url;

    License

    MIT

    Install

    npm i httpgd

    DownloadsWeekly Downloads

    210

    Version

    0.1.7

    License

    MIT

    Unpacked Size

    35.5 kB

    Total Files

    12

    Last publish

    Collaborators

    • nx10