1.1.0 • Published 10 months ago

pear-bridge v1.1.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
10 months ago

pear-bridge

Local HTTP Bridge for Pear Desktop Applications

For use with Pear User Interface libraries, such as pear-electron.

Install

npm install pear-bridge

Usage

The application entrypoint needs to instantiate the bridge and pass its info to the Pear User Interface Runtime Library.

The following example is with pear-electron but any compatible Pear UI Runtime Library should work in the same way:

import Runtime from 'pear-electron'
import Bridge from 'pear-bridge'

const runtime = new Runtime()
await runtime.ready()

const server = new Bridge()
await server.ready()

const pipe = runtime.start({ info: server.info() })
Pear.teardown(() => pipe.end())

API

new Bridge(opts) -> bridge

Options

  • mount - Mount path for lookups. Given mount = '/ui a URL pathname of /foo would be fetched from /ui/foo
  • waypoint - Catch all HTML file for any unmatched pathnames. Use this for not found screens or in-app routing

Methods

  • ready() - returns a promise that resolves when the server is listening
  • close() - closes the server

Properties

  • closed - boolean indicating if server is closed
  • opened - boolean indicating if server is opened
  • closing - promise that resolves when server closes
  • opening - promise that resolves when server opens

LICENSE

Apachae-2.0

1.1.0

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago