/* eslint-env browser */ import http from 'http' import { WebSocketServer } from 'ws' import { Session } from 'pear-inspect' import b4a from 'b4a' import { spawn } from 'child_process' customElements.define('developer-tooling', class extends HTMLElement { router = null constructor () { super() this.template = document.createElement('template') this.template.innerHTML = `
Some application setup is required to enable remote debugging
Install the pear-inspect module into the application
npm install pear-inspect
Add the following code to the application, before any other code:
if (Pear.config.dev) {
const { Inspector } = await import('pear-inspect')
const inpector = await new Inspector()
const key = await inpector.enable()
console.log('Debug with pear://runtime/devtools/'
+ key.toString('hex'))
}
When the application is opened in development mode the inspection key will be logged.
Paste the logged key into the input to add it. Then open in Chrome or copy the URL to a compatible inspect tool to view the remote target.