noobs 0.0.145 → 0.0.146

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/noobs.node CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noobs",
3
- "version": "0.0.145",
3
+ "version": "0.0.146",
4
4
  "description": "A native Node.js addon with libobs bindings for Warcraft Recorder.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -10,14 +10,20 @@
10
10
 
11
11
  void call_jscb(Napi::Env env, Napi::Function cb, SignalData* sd) {
12
12
  Napi::Object obj = Napi::Object::New(env);
13
+
13
14
  obj.Set("type", Napi::String::New(env, sd->type));
14
15
  obj.Set("id", Napi::String::New(env, sd->id));
15
16
  obj.Set("code", Napi::Number::New(env, sd->code));
17
+
16
18
 
17
19
  if (sd->value.has_value()) {
18
20
  obj.Set("value", Napi::Number::New(env, sd->value.value()));
19
21
  }
20
22
 
23
+ if (sd->error.has_value()) {
24
+ obj.Set("error", Napi::String::New(env, sd->error.value()));
25
+ }
26
+
21
27
  cb.Call({ obj });
22
28
  delete sd;
23
29
  }
@@ -571,11 +577,25 @@ obs_properties_t* ObsInterface::getSourceProperties(std::string name) {
571
577
 
572
578
  void ObsInterface::output_signal_handler(void *data, calldata_t *cd) {
573
579
  long long code = calldata_int(cd, "code");
580
+ const char *err = calldata_string(cd, "last_error");
581
+
582
+ std::optional<std::string> error;
583
+
584
+ if (err) {
585
+ error = std::string(err);
586
+ }
574
587
 
575
588
  SignalContext* ctx = static_cast<SignalContext*>(data);
576
589
  ObsInterface* self = ctx->self;
577
590
 
578
- SignalData* sd = new SignalData{ "output", ctx->id.c_str(), code };
591
+ SignalData* sd = new SignalData{
592
+ "output",
593
+ ctx->id.c_str(),
594
+ code,
595
+ std::nullopt, // No value, that's only used for volmeters.
596
+ error,
597
+ };
598
+
579
599
  self->jscb.NonBlockingCall(sd, call_jscb);
580
600
  }
581
601
 
@@ -18,6 +18,7 @@ struct SignalData {
18
18
  std::string id;
19
19
  long long code;
20
20
  std::optional<float> value;
21
+ std::optional<std::string> error;
21
22
  };
22
23
 
23
24
  struct SignalContext {