MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / httpGetJson

Function httpGetJson

tooling/scripts/sidebar-vim-smoke.mjs:102–107  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

100 })
101}
102function httpGetJson(url) {
103 return new Promise((res, rej) => {
104 const req = http.get(url, (r) => { let b = ''; r.on('data', (c) => (b += c)); r.on('end', () => { try { res(JSON.parse(b)) } catch (e) { rej(e) } }) })
105 req.on('error', rej); req.setTimeout(1000, () => req.destroy(new Error('timeout')))
106 })
107}
108class Cdp {
109 constructor(url) { this.url = url; this.id = 1; this.pending = new Map(); this.listeners = new Map() }
110 connect() {

Callers 1

connectPageFunction · 0.70

Calls 2

onMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected