I'm writing my first Perspective component that will be receiving messages from the gateway, and I just wanted to confirm my understanding on the javascript side.
I've written a ComponentStoreDelegate:
export class MaterialTreeMessageHandler extends ComponentStoreDelegate {
handleEvent(eventName: string, eventObject: JsObject): void {
console.log('handling event', eventName, eventObject);
this.notify();
}
}
Then in my component I can subscribe with:
props.store.delegate?.subscribe(() => {
console.log("message received");
})
To pass the actual message data, am I supposed to be implementing mapStateToProps
in the message delegate and then directly accessing it via:
props.store.delegate.myPropertyName
Also, is there a difference between props.delegate
and props.store.delegate
?