File: check.cc

package info (click to toggle)
node-addon-api 5.0.0-6%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,920 kB
  • sloc: cpp: 7,531; ansic: 5,297; javascript: 4,654; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 427 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "napi.h"
#if defined(NODE_ADDON_API_ENABLE_MAYBE)

using namespace Napi;

namespace {

void VoidCallback(const CallbackInfo& info) {
  Function fn = info[0].As<Function>();

  Maybe<Value> it = fn.Call({});

  it.Check();
}

}  // end anonymous namespace

Object InitMaybeCheck(Env env) {
  Object exports = Object::New(env);
  exports.Set("voidCallback", Function::New(env, VoidCallback));
  return exports;
}
#endif