@hyperbeam/web
TypeScript icon, indicating that this package has built-in type declarations

0.0.36 • Public • Published

@hyperbeam/web

The JavaScript browser-side library for the Hyperbeam virtual browser API.

Read the full documentation here.

Installation

Using npm:

$ npm install @hyperbeam/web --save

Using unpkg:

<script type="module">
  import Hyperbeam from "https://unpkg.com/@hyperbeam/web@latest/dist/index.js"
  // ...
</script>

Features

  • Connect to a multiplayer browser
  • Control the virtual browser navigation programmatically
  • Query the virtual browser state and listen to events
  • Manage user control permissions
  • Resize the browser
  • Set local multiplayer browser volume

Docs & Community

Examples

Quick Start

You can save this code snippet as example.html and run it in your browser. Make sure you set the embedURL variable to the response data from the REST API.

<div style="font-family: Arial">
  <button id="reload">Reload</button>
  <button id="back">Go Back</button>
  <button id="forward">Go Forward</button>
  <button id="youtube">Open Youtube.com</button>
  Volume: <input type="range" min="0" max="100" value="100" id="range">
  <p>User ID: <span id="userId"></span></p>
  <p>Current website: <span id="currentSite"></p>
</div>
<div id="container" style="height:720px;width:1280px"></div>

<script type="module">
  import Hyperbeam from "https://unpkg.com/@hyperbeam/web@latest/dist/index.js"

  // TODO: Set the embedURL variable
  const embedURL = "<your-embed-url>"

  const hb = await Hyperbeam(container, embedURL)
  userId.innerText = hb.userId
  reload.addEventListener("click", () => {
    hb.tabs.reload()
  })
  back.addEventListener("click", () => {
    hb.tabs.goBack()
  })
  forward.addEventListener("click", () => {
    hb.tabs.goForward()
  })
  youtube.addEventListener("click", () => {
    hb.tabs.update({ url: "https://youtube.com" })
  })
  range.addEventListener("change", (e) => {
    hb.volume = e.target.value / 100
  })
  hb.tabs.onUpdated.addListener((tabId, changeInfo) => {
    if (changeInfo.title) {
      currentSite.innerText = changeInfo.title
    }
  })
</script>

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @hyperbeam/web

    Weekly Downloads

    1,543

    Version

    0.0.36

    License

    none

    Unpacked Size

    41 kB

    Total Files

    4

    Last publish

    Collaborators

    • ambyjkl
    • scottyfillups