@remotehq/remote-browser-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

@remotehq/remote-browser-sdk

The official JavaScript/TypeScript client SDK for embedding and controlling Remote Browser by RemoteHQ.

Installation

# via npm
npm install --save @remotehq/remote-browser-sdk

# via yarn
yarn add @remotehq/remote-browser-sdk

Usage example

import * as remoteBrowserSdk from "@remotehq/remote-browser-sdk";

// 1. Get instanceURN via API call
const instanceURN = "..."; // received from the API

// 2. Create new client instance
const rbClient = remoteBrowserSdk.createClient({
  instanceURN,
  iframeSource: "rhq", // unique value per customer
  role: "...", // unique value representing a role (returned via API when creating new instance)
  userName: "Jon",
  allowFullscreen: true,
  disableAudio: false,
  logoUrl: "...", // customize the experience by changing default logo to your own
  targetOrigin: "https://rooms.remotehq.com", // If we setup a custom domain for you - you'll need to change this value
  barLocation: "top-right" // or 'top-left', determines location of the top navigation
});

// 3. Attach to DOM
rbClient.attach("#remote-browser-container"); // Selector or Element

// 4. Enjoy external API to control the Remote Browser
rbClient.openInCurrentTab("https://weather.com");
rbClient.openInNewTab("https://weather.com");

// 5. Listen for extra messages
function onError (error) { ... }
this.rbClient.on('openInCurrentTab:error', onError);
this.rbClient.off('openInCurrentTab:error', onError);

// 6. Destroy when not using anymore
rbClient.destroy();

Documentation

For full documentation, visit the official RemoteHQ documentation.

Package Sidebar

Install

npm i @remotehq/remote-browser-sdk

Weekly Downloads

2

Version

1.4.0

License

UNLICENSED

Unpacked Size

15.6 kB

Total Files

11

Last publish

Collaborators

  • michalsnik
  • lsiv568