I can create a new durable object instance by using
NAMESPACE.idFromName(name) , this creates a object ID from a name string, but I cannot find this name inside the object.
In the constructor of the object it has a property called
state.id which can be turned into a hex string later using its
.toString() method. But when I create this node from
.idFromName(name) , this method still returns its ID in a hex form. Is there any way to tell what the name of the object is?
Otherwise, I am wondering is there any way pass some metadata into a durable object at time of creation.
I’m trying to do this because I want to create a bunch of objects that only need one instance but perform different role, and I don’t want to define a separate class for each of them.