sync.cc 645 Bytes
Newer Older
1
/*********************************************************************
2 3
 * NAN - Native Abstractions for Node.js
 *
4
 * Copyright (c) 2018 NAN contributors
5
 *
6
 * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
7
 ********************************************************************/
8 9

#include <nan.h>
10 11
#include "pi_est.h"  // NOLINT(build/include)
#include "sync.h"  // NOLINT(build/include)
12 13 14 15

// Simple synchronous access to the `Estimate()` function
NAN_METHOD(CalculateSync) {
  // expect a number as the first argument
16
  int points = info[0]->Uint32Value();
17 18
  double est = Estimate(points);

19
  info.GetReturnValue().Set(est);
20
}