Skip to content

packages/engine/scram/targets/scram-node/src/InitModule.cpp

Functions

Name
Napi::ObjectInit(Napi::Env env, Napi::Object exports)<br>Initializes the module, making the SCRAM functions available to Node.js.

Functions Documentation

function Init

cpp
Napi::Object Init(
    Napi::Env env,
    Napi::Object exports
)

Initializes the module, making the SCRAM functions available to Node.js.

Parameters:

  • env The Napi environment.
  • exports The exports object to add the function to.

Return: Napi::Object The modified exports object.

Source code

cpp
#include <napi.h>

#include "ScramNodeQuantify.h"
#include "ScramNodeModel.h"

Napi::Object Init(Napi::Env env, Napi::Object exports) {
    exports.Set("QuantifyModel", Napi::Function::New(env, QuantifyModel));
    exports.Set("BuildModelOnly", Napi::Function::New(env, BuildModelOnly));
    return exports;
}

// Macro to register the module with Node.js
NODE_API_MODULE(scram_node, Init)

Updated on 2026-01-09 at 21:59:13 +0000