diagnostics_channel.unsubscribe(name, onMessage)
-
onMessage
<Function> 要删除的先前订阅的处理程序¥
onMessage
<Function> The previous subscribed handler to remove -
返回:<boolean> 如果找到处理程序则为
true
,否则为false
。¥Returns: <boolean>
true
if the handler was found,false
otherwise.
删除以前使用 diagnostics_channel.subscribe(name, onMessage)
注册到此通道的消息处理程序。
¥Remove a message handler previously registered to this channel with
diagnostics_channel.subscribe(name, onMessage)
.
import diagnostics_channel from 'diagnostics_channel';
function onMessage(message, name) {
// Received data
}
diagnostics_channel.subscribe('my-channel', onMessage);
diagnostics_channel.unsubscribe('my-channel', onMessage);
const diagnostics_channel = require('diagnostics_channel');
function onMessage(message, name) {
// Received data
}
diagnostics_channel.subscribe('my-channel', onMessage);
diagnostics_channel.unsubscribe('my-channel', onMessage);