nonfunctional public setter on Worker

I understand that appData gets set ONCE during the producer factory method

why is this setter a public function then if it’s supposed to be “invalid”/we can’t override the appData after the producer has been initialized?

appData is an object and you can change its content at any time, but you cannot override the whole object. There is a reason for this but I don’t remember the details now.

i see

okay if I can’t use the setter, how am I supposed to change its contents?

thanks for taking the time to reply, always appreciate it :smiley:

as a follow-up, unrelated to this so i don’t expect an answer :stuck_out_tongue: but I wanted to fetch all the producers on a router which is maintained within the Router class as a private hashmap - is there a simpler way to do this than to maintain the state ourselves in the app?

if I were to maintain these states in the app, will I be using an observer on all the transports for @newproducer and @producerclose, check which router the transport/producer belongs to, and store it accordingly?

You can’t replace appData, but you can modify its contents.

No, that is how you are supposed to use it.

Please JUST use public API and public events, those that are documented.

I wonder what’s the purpose of the setter then? Typescript is compiled to the strict-mode JavaScript, and in the strict mode assigning a getter-only property throws a TypeError - essentially the same as this setter does.