1.1.0 • Published 9 months ago
pear-bridge v1.1.0
pear-bridge
Local HTTP Bridge for Pear Desktop Applications
For use with Pear User Interface libraries, such as pear-electron.
Install
npm install pear-bridgeUsage
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. Givenmount = '/uia URL pathname of/foowould be fetched from/ui/foowaypoint- 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 listeningclose()- closes the server
Properties
closed- boolean indicating if server is closedopened- boolean indicating if server is openedclosing- promise that resolves when server closesopening- promise that resolves when server opens
LICENSE
Apachae-2.0