【发布时间】:2019-09-02 13:33:04
【问题描述】:
broker.onTopic = function onTopic(topic: string, callback: Function): void {
log.debug(`Callback to add: ${JSON.stringify(callback, null, 4)}`);
//...more code
我的代码中的其他地方:
interface ACPOSObject {
data: State;
}
interface State {
state: string;
}
broker.onTopic('[A-Z0-9]+/[A-Z0-9]+/[A-Z0-9]+/LINE/[A-Z]+/ACPOS', function onCenterline(
topic: string,
message: ACPOSObject
): void {
log.debug(`New message in to topic: ${topic} message: ${message}`);
日志显示:
2019-09-02T13:29:59.370Z debug: Callback to add: undefined
为什么回调是undefined?
【问题讨论】:
标签: typescript