mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
8dcce52c33
The C++ implementation can now be done entirely in JS using WeakRef. Re-implement it in JS instead to simplify the code. PR-URL: https://github.com/nodejs/node/pull/49053 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
15 lines
317 B
JavaScript
15 lines
317 B
JavaScript
'use strict';
|
|
|
|
const { WeakReference } = require('internal/util');
|
|
const {
|
|
setDeserializeMainFunction
|
|
} = require('v8').startupSnapshot
|
|
const assert = require('assert');
|
|
|
|
let obj = { hello: 'world' };
|
|
const ref = new WeakReference(obj);
|
|
|
|
setDeserializeMainFunction(() => {
|
|
assert.strictEqual(ref.get(), obj);
|
|
});
|