Serializes a JavaScript function into a text form that can be loaded in
another execution context, for example as part of a function callback
associated with an AWS Lambda. The function serialization captures any
variables captured by the function body and serializes those values into the
generated text along with the function body. This process is recursive, so
that functions referenced by the body of the serialized function will
themselves be serialized as well. This process also deeply serializes
captured object values, including prototype chains and property descriptors,
such that the semantics of the function when deserialized should match the
original function.
There are several known limitations:
If a native function is captured either directly or indirectly, closure
serialization will return an error.
Captured values will be serialized based on their values at the time that
serializeFunction is called. Mutations to these values after that (but
before the deserialized function is used) will not be observed by the
deserialized function.
Serializes a JavaScript function into a text form that can be loaded in another execution context, for example as part of a function callback associated with an AWS Lambda. The function serialization captures any variables captured by the function body and serializes those values into the generated text along with the function body. This process is recursive, so that functions referenced by the body of the serialized function will themselves be serialized as well. This process also deeply serializes captured object values, including prototype chains and property descriptors, such that the semantics of the function when deserialized should match the original function.
There are several known limitations:
If a native function is captured either directly or indirectly, closure serialization will return an error.
Captured values will be serialized based on their values at the time that
serializeFunction
is called. Mutations to these values after that (but before the deserialized function is used) will not be observed by the deserialized function.