#include <napi.h>
#include <exception>
#include <iostream>
Go to the source code of this file.
|
| Value | RESTCall (const Napi::CallbackInfo &info) |
| |
| Object | Init (Env env, Object exports) |
| |
◆ Init()
| Object Init |
( |
Env |
env, |
|
|
Object |
exports |
|
) |
| |
Definition at line 55 of file dummy-addon.cc.
References RESTCall().
56 std::cout <<
"Init"<<std::endl;
57 exports.Set(String::New(env,
"call"), Function::New(env,
RESTCall));
Value RESTCall(const Napi::CallbackInfo &info)
◆ RESTCall()
| Value RESTCall |
( |
const Napi::CallbackInfo & |
info | ) |
|
Definition at line 29 of file dummy-addon.cc.
Referenced by Init().
32 if (info.Length() < 1)
34 Napi::TypeError::New(env,
"Needs to be call(endpoint[, arguments])").ThrowAsJavaScriptException();
42 catch (
const std::exception& ex)
45 Napi::Error::New(env, ex.what()).ThrowAsJavaScriptException();
50 Napi::Error::New(env,
"unknown exception caught").ThrowAsJavaScriptException();