Closed trusktr closed 8 years ago
What if an instance to the MyType constructor isn't available in the destination where the encoded value is sent?
No, a type needs to be registered on both side.
Does it encode the full prototype chain, so when decoded the new object is the same as one that would have been created with new?
No, the prototype chain is not encoded. The object will be the same as if it has been created with the local prototype.
@mcollina Any examples of those cases?
@mcollina Ah, gotcha. Thanks!
So, can we in theory encode an instance of a class then decode it multiple times in order to create new instances instead of using the
new
keyword over and over??
I was wondering, because of the example in the README:
What if an instance to the
MyType
constructor isn't available in the destination where the encoded value is sent? Does it encode the full prototype chain, so when decoded the new object is the same as one that would have been created withnew
?