pear-bridge
v1.2.5
Published
Local HTTP Bridge for Pear Desktop Applications
Downloads
1,963
Maintainers
Readme
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- String. Mount path for lookups. Givenmount = '/uia URL pathname of/foowould be fetched from/ui/foo.waypoint- String. Catch all HTML file for any unmatched pathnames. Use this for not found screens or in-app routing. Specify relative tomount.bypass- Array. Default ['/node_modules']. Advanced. Mount bypass, allows dependency discovery from application root.
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
Apache-2.0
