MCPcopy Index your code
hub / github.com/nodejs/node / subscribe

Function subscribe

test/parallel/test-diagnostics-channel-web-locks.js:8–20  ·  view source on GitHub ↗
({ start, grant, miss, end })

Source from the content-addressed store, hash-verified

6const dc = require('node:diagnostics_channel');
7
8function subscribe({ start, grant, miss, end }) {
9 if (start) dc.subscribe('locks.request.start', start);
10 if (grant) dc.subscribe('locks.request.grant', grant);
11 if (miss) dc.subscribe('locks.request.miss', miss);
12 if (end) dc.subscribe('locks.request.end', end);
13
14 return () => {
15 if (start) dc.unsubscribe('locks.request.start', start);
16 if (grant) dc.unsubscribe('locks.request.grant', grant);
17 if (miss) dc.unsubscribe('locks.request.miss', miss);
18 if (end) dc.unsubscribe('locks.request.end', end);
19 };
20}
21
22describe('Web Locks diagnostics channel', () => {
23 it('emits start, grant, and end on success', async () => {

Calls 2

subscribeMethod · 0.45
unsubscribeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…