Ejemplo n.º 1
0
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor desc[2] = {
    DECLARE_NAPI_PROPERTY("RunCallback", RunCallback),
    DECLARE_NAPI_PROPERTY("RunCallbackWithRecv", RunCallbackWithRecv),
  };
  NAPI_CALL(env, napi_define_properties(env, exports, 2, desc));
  return exports;
}
Ejemplo n.º 2
0
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("Test", Test),
    DECLARE_NAPI_PROPERTY("New", New),
  };

  NAPI_CALL_RETURN_VOID(env, napi_define_properties(
    env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));
}
Ejemplo n.º 3
0
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor properties[] = {
    DECLARE_NAPI_PROPERTY("Test", Test),
    DECLARE_NAPI_PROPERTY("TestStringLength", TestStringLength),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(properties) / sizeof(*properties), properties));

  return exports;
}
Ejemplo n.º 4
0
static napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("CreateDataView", CreateDataView),
    DECLARE_NAPI_PROPERTY("CreateDataViewFromJSDataView",
        CreateDataViewFromJSDataView)
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}
Ejemplo n.º 5
0
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("Multiply", Multiply),
    DECLARE_NAPI_PROPERTY("External", External),
    DECLARE_NAPI_PROPERTY("CreateTypedArray", CreateTypedArray),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}
Ejemplo n.º 6
0
static napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("Test", Test),
    DECLARE_NAPI_PROPERTY("TestInt32Truncation", TestInt32Truncation),
    DECLARE_NAPI_PROPERTY("TestUint32Truncation", TestUint32Truncation),
    DECLARE_NAPI_PROPERTY("TestInt64Truncation", TestInt64Truncation),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}
Ejemplo n.º 7
0
EXTERN_C_START
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor properties[] = {
    DECLARE_NAPI_PROPERTY("NewScope", NewScope),
    DECLARE_NAPI_PROPERTY("NewScopeEscape", NewScopeEscape),
    DECLARE_NAPI_PROPERTY("NewScopeEscapeTwice", NewScopeEscapeTwice),
    DECLARE_NAPI_PROPERTY("NewScopeWithException", NewScopeWithException),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(properties) / sizeof(*properties), properties));

  return exports;
}
Ejemplo n.º 8
0
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("TestGetElement", TestGetElement),
    DECLARE_NAPI_PROPERTY("TestHasElement", TestHasElement),
    DECLARE_NAPI_PROPERTY("TestDeleteElement", TestDeleteElement),
    DECLARE_NAPI_PROPERTY("New", New),
    DECLARE_NAPI_PROPERTY("NewWithLength", NewWithLength),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}
Ejemplo n.º 9
0
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("testStrictEquals", testStrictEquals),
    DECLARE_NAPI_PROPERTY("testGetPrototype", testGetPrototype),
    DECLARE_NAPI_PROPERTY("testGetVersion", testGetVersion),
    DECLARE_NAPI_PROPERTY("doInstanceOf", doInstanceOf),
    DECLARE_NAPI_PROPERTY("getUndefined", getUndefined),
    DECLARE_NAPI_PROPERTY("getNull", getNull),
    DECLARE_NAPI_PROPERTY("createNapiError", createNapiError),
    DECLARE_NAPI_PROPERTY("testNapiErrorCleanup", testNapiErrorCleanup),
    DECLARE_NAPI_PROPERTY("testNapiTypeof", testNapiTypeof),
    DECLARE_NAPI_PROPERTY("wrap", wrap),
  };

  NAPI_CALL_RETURN_VOID(env, napi_define_properties(
    env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));
}
Ejemplo n.º 10
0
static napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor properties[] = {
    DECLARE_NAPI_PROPERTY("New", New),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(properties) / sizeof(*properties), properties));

  return exports;
}
Ejemplo n.º 11
0
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("Get", Get),
    DECLARE_NAPI_PROPERTY("Set", Set),
    DECLARE_NAPI_PROPERTY("Has", Has),
    DECLARE_NAPI_PROPERTY("HasOwn", HasOwn),
    DECLARE_NAPI_PROPERTY("Delete", Delete),
    DECLARE_NAPI_PROPERTY("New", New),
    DECLARE_NAPI_PROPERTY("Inflate", Inflate),
    DECLARE_NAPI_PROPERTY("Wrap", Wrap),
    DECLARE_NAPI_PROPERTY("Unwrap", Unwrap),
  };

  NAPI_CALL_RETURN_VOID(env, napi_define_properties(
    env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));
}
Ejemplo n.º 12
0
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("Get", Get),
    DECLARE_NAPI_PROPERTY("Set", Set),
    DECLARE_NAPI_PROPERTY("Has", Has),
    DECLARE_NAPI_PROPERTY("HasOwn", HasOwn),
    DECLARE_NAPI_PROPERTY("Delete", Delete),
    DECLARE_NAPI_PROPERTY("New", New),
    DECLARE_NAPI_PROPERTY("Inflate", Inflate),
    DECLARE_NAPI_PROPERTY("Wrap", Wrap),
    DECLARE_NAPI_PROPERTY("Unwrap", Unwrap),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}
Ejemplo n.º 13
0
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
  napi_property_descriptor properties[] = {
    DECLARE_NAPI_PROPERTY("TestLatin1", TestLatin1),
    DECLARE_NAPI_PROPERTY("TestLatin1Insufficient", TestLatin1Insufficient),
    DECLARE_NAPI_PROPERTY("TestUtf8", TestUtf8),
    DECLARE_NAPI_PROPERTY("TestUtf8Insufficient", TestUtf8Insufficient),
    DECLARE_NAPI_PROPERTY("TestUtf16", TestUtf16),
    DECLARE_NAPI_PROPERTY("TestUtf16Insufficient", TestUtf16Insufficient),
    DECLARE_NAPI_PROPERTY("Utf16Length", Utf16Length),
    DECLARE_NAPI_PROPERTY("Utf8Length", Utf8Length),
  };

  NAPI_CALL_RETURN_VOID(env, napi_define_properties(
    env, exports, sizeof(properties) / sizeof(*properties), properties));
}
Ejemplo n.º 14
0
static napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_GETTER("finalizeCount", GetFinalizeCount),
    DECLARE_NAPI_PROPERTY("createExternal", CreateExternal),
    DECLARE_NAPI_PROPERTY("createExternalWithFinalize",
        CreateExternalWithFinalize),
    DECLARE_NAPI_PROPERTY("checkExternal", CheckExternal),
    DECLARE_NAPI_PROPERTY("createReference", CreateReference),
    DECLARE_NAPI_PROPERTY("deleteReference", DeleteReference),
    DECLARE_NAPI_PROPERTY("incrementRefcount", IncrementRefcount),
    DECLARE_NAPI_PROPERTY("decrementRefcount", DecrementRefcount),
    DECLARE_NAPI_GETTER("referenceValue", GetReferenceValue),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}
Ejemplo n.º 15
0
static napi_value Init(napi_env env, napi_value exports) {
  napi_value theValue;

  NAPI_CALL(env,
      napi_create_string_utf8(env, theText, sizeof(theText), &theValue));
  NAPI_CALL(env, napi_set_named_property(env, exports, "theText", theValue));

  napi_property_descriptor methods[] = {
    DECLARE_NAPI_PROPERTY("newBuffer", newBuffer),
    DECLARE_NAPI_PROPERTY("newExternalBuffer", newExternalBuffer),
    DECLARE_NAPI_PROPERTY("getDeleterCallCount", getDeleterCallCount),
    DECLARE_NAPI_PROPERTY("copyBuffer", copyBuffer),
    DECLARE_NAPI_PROPERTY("bufferHasInstance", bufferHasInstance),
    DECLARE_NAPI_PROPERTY("bufferInfo", bufferInfo),
    DECLARE_NAPI_PROPERTY("staticBuffer", staticBuffer),
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(methods) / sizeof(methods[0]), methods));

  return exports;
}
Ejemplo n.º 16
0
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
  napi_property_descriptor desc = DECLARE_NAPI_PROPERTY("hello", Method);
  NAPI_CALL_RETURN_VOID(env, napi_define_properties(env, exports, 1, &desc));
}
Ejemplo n.º 17
0
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
  napi_property_descriptor desc =
    DECLARE_NAPI_PROPERTY("exports", CreateFunction);
  NAPI_CALL_RETURN_VOID(env, napi_define_properties(env, module, 1, &desc));
}
Ejemplo n.º 18
0
EXTERN_C_START
napi_value Init(napi_env env, napi_value exports) {
  napi_property_descriptor descriptors[] = {
    DECLARE_NAPI_PROPERTY("testStrictEquals", testStrictEquals),
    DECLARE_NAPI_PROPERTY("testGetPrototype", testGetPrototype),
    DECLARE_NAPI_PROPERTY("testGetVersion", testGetVersion),
    DECLARE_NAPI_PROPERTY("testNapiRun", testNapiRun),
    DECLARE_NAPI_PROPERTY("doInstanceOf", doInstanceOf),
    DECLARE_NAPI_PROPERTY("getUndefined", getUndefined),
    DECLARE_NAPI_PROPERTY("getNull", getNull),
    DECLARE_NAPI_PROPERTY("createNapiError", createNapiError),
    DECLARE_NAPI_PROPERTY("testNapiErrorCleanup", testNapiErrorCleanup),
    DECLARE_NAPI_PROPERTY("testNapiTypeof", testNapiTypeof),
    DECLARE_NAPI_PROPERTY("wrap", wrap),
    DECLARE_NAPI_PROPERTY("unwrap", unwrap),
    DECLARE_NAPI_PROPERTY("removeWrap", remove_wrap),
    DECLARE_NAPI_PROPERTY("addFinalizerOnly", add_finalizer_only),
    DECLARE_NAPI_PROPERTY("testFinalizeWrap", test_finalize_wrap),
    DECLARE_NAPI_PROPERTY("finalizeWasCalled", finalize_was_called),
    DECLARE_NAPI_PROPERTY("derefItemWasCalled", deref_item_was_called),
    DECLARE_NAPI_PROPERTY("testAdjustExternalMemory", testAdjustExternalMemory)
  };

  NAPI_CALL(env, napi_define_properties(
      env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors));

  return exports;
}