Files
peardata/index.js
T
Raven Scott f7e26d1aac
Release rolling / release (push) Successful in 25s
CI / test (push) Successful in 28s
Testing
2026-07-18 16:33:43 -04:00

41 lines
799 B
JavaScript

/**
* Pear desktop entrypoint.
* Boots pear-electron UI + pear-bridge HTTP for the HTML app shell.
*
* Under Bare: load bare-node-runtime globals so shared/client code can use
* process/Buffer while package.json `imports` maps builtins → bare-*.
*
* @typedef {import('pear-interface')}
*/
/* global Pear */
if (typeof globalThis.Bare !== 'undefined') {
await import('bare-node-runtime/global')
}
import Runtime from 'pear-electron'
import Bridge from 'pear-bridge'
const bridge = new Bridge()
await bridge.ready()
const runtime = new Runtime()
const pipe = await runtime.start({ bridge })
const shutdown = async () => {
try {
Pear.exit()
} catch {
// ignore
}
}
pipe.on('close', () => {
shutdown()
})
try {
Pear.teardown?.(async () => {})
} catch {
// ignore
}