feat(npm): implement Node API (#13633)

This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
This commit is contained in:
Divy Srivastava 2022-10-05 07:06:44 -07:00 committed by GitHub
parent 3a3a848406
commit 0b016a7fb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 5299 additions and 2 deletions

16
test_napi/async_test.js Normal file
View file

@ -0,0 +1,16 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { assertEquals, loadTestLibrary } from "./common.js";
const asyncTask = loadTestLibrary();
Deno.test("napi async task schedule", async () => {
let called = false;
await new Promise((resolve) => {
asyncTask.test_async_work(() => {
called = true;
resolve();
});
});
assertEquals(called, true);
});