nstdlib-nightly
Version:
Node.js standard library converted to runtime-agnostic ES modules.
44 lines (35 loc) • 814 B
JavaScript
// Source: https://github.com/nodejs/node/blob/65eff1eb/lib/internal/test/transfer.js
import {
markTransferMode,
kClone,
kDeserialize,
} from "nstdlib/lib/internal/worker/js_transferable";
process.emitWarning(
"These APIs are for internal testing only. Do not use them.",
"internal/test/transfer",
);
// Used as part of parallel/test-messaging-maketransferable.
// This has to exist within the lib/internal/ path in order
// for deserialization to work.
class E {
constructor(b) {
this.b = b;
}
}
class F extends E {
constructor(b) {
super(b);
markTransferMode(this, true, false);
}
[kClone]() {
return {
data: { b: this.b },
deserializeInfo: "internal/test/transfer:F",
};
}
[kDeserialize]({ b }) {
this.b = b;
}
}
export { E };
export { F };