Curent examples cover cases only with 1 properties get created inside Init.
Is any chance to give examples how to create multiple properties?
napi_value Init(napi_env env, napi_value exports) {
napi_status status;
napi_value fn;
read_dht_data();
status = napi_create_function(env, NULL, 0, myGetTemp, NULL, &fn);
if (status != napi_ok) {
napi_throw_error(env, NULL, "Unable to wrap native function");
}
status = napi_set_named_property(env, exports, "getTemp", fn);
if (status != napi_ok) {
napi_throw_error(env, NULL, "Unable to populate exports");
}
status = napi_create_function(env, NULL, 0, myGetTemp2, NULL, &fn);
if (status != napi_ok) {
napi_throw_error(env, NULL, "Unable to wrap native function");
}
status = napi_set_named_property(env, exports, "getTemp2", fn);
if (status != napi_ok) {
napi_throw_error(env, NULL, "Unable to populate exports");
}
return exports;
}