mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
80b56bbab0
PR-URL: https://github.com/nodejs/node/pull/55116 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Claudio Wunder <cwunder@gnome.org>
16 lines
443 B
JavaScript
16 lines
443 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const dc = require('node:diagnostics_channel');
|
|
|
|
const channel_name = 'test:channel';
|
|
const published_data = 'some message';
|
|
|
|
const onMessageHandler = common.mustCall(() => dc.unsubscribe(channel_name, onMessageHandler));
|
|
|
|
dc.subscribe(channel_name, onMessageHandler);
|
|
dc.subscribe(channel_name, common.mustCall());
|
|
|
|
// This must not throw.
|
|
dc.channel(channel_name).publish(published_data);
|