wstp-node 0.6.0 → 0.6.1

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wstp-node",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Native Node.js addon for Wolfram/Mathematica WSTP — kernel sessions with evaluation queue, streaming Print/messages, Dialog subsessions, and side-channel WstpReader",
5
5
  "main": "build/Release/wstp.node",
6
6
  "types": "index.d.ts",
package/src/addon.cc CHANGED
@@ -2337,6 +2337,8 @@ public:
2337
2337
  int ms = static_cast<int>(info[0].As<Napi::Number>().Int32Value());
2338
2338
  if (ms < 0) ms = 0;
2339
2339
  int prev = dynIntervalMs_.exchange(ms);
2340
+ // Auto-enable dynAutoMode when interval > 0, auto-disable when 0.
2341
+ dynAutoMode_.store(ms > 0);
2340
2342
  // Start timer thread if transitioning from 0 to non-zero.
2341
2343
  if (prev == 0 && ms > 0 && !dynTimerRunning_.load()) {
2342
2344
  StartDynTimer();
@@ -2717,7 +2719,7 @@ private:
2717
2719
  std::vector<DynRegistration> dynRegistry_; // registered exprs
2718
2720
  std::vector<DynResult> dynResults_; // accumulated results (swapped on getDynamicResults)
2719
2721
  std::atomic<int> dynIntervalMs_{0}; // 0 = disabled
2720
- std::atomic<bool> dynAutoMode_{true}; // true = inline C++ path; false = legacy JS path
2722
+ std::atomic<bool> dynAutoMode_{false}; // true = inline C++ path; false = legacy JS path
2721
2723
  int dynTaskInstalledInterval_{0}; // interval of currently installed ScheduledTask (0 = none)
2722
2724
  std::chrono::steady_clock::time_point dynLastEval_{}; // time of last successful dialog eval
2723
2725
  std::thread dynTimerThread_;
package/test.js CHANGED
@@ -735,8 +735,7 @@ async function main() {
735
735
 
736
736
  let evalDone = false;
737
737
  const mainProm = s.evaluate(
738
- 'pP1 = 0; Pause[8]; pP1 = 1; "p1-done"',
739
- { onDialogBegin: () => {}, onDialogEnd: () => {} }
738
+ 'pP1 = 0; Pause[8]; pP1 = 1; "p1-done"'
740
739
  ).then(() => { evalDone = true; });
741
740
 
742
741
  await sleep(300);