mirror of
https://github.com/nodejs/node.git
synced 2025-05-22 08:35:19 +00:00

- Merge the two almost-but-not-quite identical `MakeCallback()` implementations - Provide a public `CallbackScope` class for embedders in order to enable `MakeCallback()`-like behaviour without tying that to calling a JS function PR-URL: https://github.com/nodejs/node/pull/14697 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
18 lines
426 B
JavaScript
18 lines
426 B
JavaScript
'use strict';
|
|
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
const { runInCallbackScope } = require(`./build/${common.buildType}/binding`);
|
|
|
|
assert.strictEqual(runInCallbackScope({}, 0, 0, () => 42), 42);
|
|
|
|
{
|
|
process.once('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'foo');
|
|
}));
|
|
|
|
runInCallbackScope({}, 0, 0, () => {
|
|
throw new Error('foo');
|
|
});
|
|
}
|