Skip to content

Commit 7264226

Browse files
committed
refactor: cleanup
1 parent 89b8a9d commit 7264226

File tree

3 files changed

+2
-54
lines changed

3 files changed

+2
-54
lines changed

packages/node-addon-examples/tests/make_callback/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ target_compile_features(addon PRIVATE cxx_std_17)
1212
if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
1313
# Generate node.lib
1414
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
15-
endif()
15+
endif()

packages/node-addon-examples/tests/make_callback/addon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ static napi_value Init(napi_env env, napi_value exports) {
6565
return exports;
6666
}
6767

68-
NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)
68+
NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)

packages/node-addon-examples/tests/make_callback/addon.js

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -48,56 +48,4 @@ module.exports = () => {
4848
makeCallback(resource, process, myMultiArgFunc, 1, 2, 3),
4949
42
5050
);
51-
52-
// TODO(node-api): napi_make_callback needs to support
53-
// strings passed for the func argument
54-
//
55-
// const recv = {
56-
// one: function () {
57-
// assert.strictEqual(0, arguments.length);
58-
// assert.strictEqual(this, recv);
59-
// return 42;
60-
// },
61-
// two: function (x) {
62-
// assert.strictEqual(1, arguments.length);
63-
// assert.strictEqual(this, recv);
64-
// assert.strictEqual(x, 1339);
65-
// return 42;
66-
// },
67-
// };
68-
69-
// assert.strictEqual(makeCallback(recv, "one"), 42);
70-
// assert.strictEqual(makeCallback(recv, "two", 1337), 42);
71-
//
72-
// Check that callbacks on a receiver from a different context works.
73-
// const foreignObject = vm.runInNewContext('({ fortytwo() { return 42; } })');
74-
// const foreignObject = { fortytwo: () => 42 };
75-
// assert.strictEqual(makeCallback(foreignObject, "fortytwo"), 42);
76-
77-
// Check that the callback is made in the context of the receiver.
78-
79-
// const target = vm.runInNewContext(`
80-
// (function($Object) {
81-
// if (Object === $Object)
82-
// throw new Error('bad');
83-
// return Object;
84-
// })
85-
// `);
86-
// assert.notStrictEqual(makeCallback(resource, process, target, Object), Object);
87-
88-
// // Runs in inner context.
89-
// const forward = vm.runInNewContext(`
90-
// (function(forward) {
91-
// return forward(Object);
92-
// })
93-
// `);
94-
95-
// // Runs in outer context.
96-
// function endpoint($Object) {
97-
// if (Object === $Object)
98-
// throw new Error('bad');
99-
// return Object;
100-
// }
101-
102-
// assert.strictEqual(makeCallback(resource, process, forward, endpoint), Object);
10351
};

0 commit comments

Comments
 (0)