npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rbbn/distant-web

v1.2.2

Published

Web implementation of the distant server.

Downloads

431

Readme

Distant Web

A library for testing your application without the need for a Citrix channel by providing APIs compatible with Distant and Distant VDI and providing an implementation based on the browser native window.open() method.

Usage

JavaScript

Install using npm:

npm install @rbbn/distant-web

or yarn:

yarn add @rbbn/distant-web

Here's some example code from an application. Distant Web is effectively a drop-in replacement for Pull VChannel, as you can see below the only difference between this and using a Citrix channel is that we are passing a distant-web connection rather than a pull-vchannel connection to distant's createController(). This code does however need to be run from within a browser due to the fact that Distant Web uses window.open().

import { createController } from '@rbbn/distant'

import { createConnection } from '@rbbn/distant-web'

const textEncoder = new TextEncoder()

const distantWebConnection = createConnection()

// here we pass a distant-web connection rather one from pull-vchannel
const distantController = createController(distantWebConnection)

// creating a session will now open a window with window.open()
const session = await distantController.createSession({
  id: 1,
  url: "http://example.com/remote.html"
})

// we use the session as we would normally
session.sendMessage(textEncoder.encode('hello'))

On the remote app side of this example we don't need to do anything differently. The remote app will be opened in a new browser window and distant-web will provided all that is needed for distant-remote to work.

import distantRemote from '@rbbn/distant-remote'

const textDecoder = new TextDecoder()

distantRemote.on('message', (message) => {
  if (textDecoder.decode(message) === 'hello') {
    distantRemote.setWindowVisible(true)
  }
})

Platform support

Support for different platforms is handled by passing in a windowFactory to Distant Web's createConnection() function. Distant Web provides window factories for both browsers and Electron. If no windowFactory is specified the browser windowFactory is used.

import {
  createConnection,
  createWebWindow,
  createElectronWindow
} from '@rbbn/distant-web'

// if we're running in a browser (this is the default if none specified)
const distantWebConnection = createConnection({
  windowFactory: createWebWindow
})

// if we're running in the Electron main process
const distantWebConnection = createConnection({
  windowFactory: createElectronWindow
})

Known Issues

Web Window Factory

  • When trying to resize a window to very small dimensions the window will fall back to using larger dimensions. The minimum size of a window is usually between 100x100 and 280x225 depending on the platform

  • When using Electron or Chrome on Windows 10 the window's title bar will still be visible when it should be hidden

  • When using Chrome on Mac the window will be small when it should be hidden. The window might change size while it should still be hidden.