broker.onTopic = function onTopic(topic: string, callback: Function): void {
log.debug(`Callback to add: ${JSON.stringify(callback, null, 4)}`);
//...more code
Somewhere else in my 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}`);
Logs show this:
2019-09-02T13:29:59.370Z debug: Callback to add: undefined
Why is the callback undefined
?