Exemplo n.º 1
0
static bool RunIoTjs(JObject* process) {
  // Evaluating 'iotjs.js' returns a function.
#ifndef ENABLE_SNAPSHOT
  JResult jmain = JObject::Eval(String(iotjs_s, iotjs_l), false, false);
#else
  JResult jmain = JObject::ExecSnapshot(iotjs_s, iotjs_l);
#endif
  IOTJS_ASSERT(jmain.IsOk());

  // Run the entry function passing process builtin.
  // The entry function will continue initializing process module, global, and
  // other native modules, and finally load and run application.
  JArgList args(1);
  args.Add(*process);

  JObject global(JObject::Global());
  JResult jmain_res = jmain.value().Call(global, args);

  if (jmain_res.IsException()) {
    UncaughtException(jmain_res.value());
    return false;
  } else {
    return true;
  }
}
Exemplo n.º 2
0
 virtual ~TInverseFilter() throw () {
     if (!UncaughtException()) {
         try {
             Finish();
         } catch (...) {
         }
     } else {
         //rely on gc
     }
 }
Exemplo n.º 3
0
static bool InitIoTjs(JObject* process) {
  JResult jmain = JObject::Eval(String(mainjs), false, false);
  IOTJS_ASSERT(jmain.IsOk());

  JArgList args(1);
  args.Add(*process);

  JObject global(JObject::Global());
  JResult jmain_res = jmain.value().Call(global, args);

  if (jmain_res.IsException()) {
    UncaughtException(jmain_res.value());
    return false;
  } else {
    return true;
  }
}