public InternalHandle CreateConnection(V8Engine engine, bool isConstructCall, InternalHandle _this, InternalHandle[] args) { try { if (args.Length >= 1) { var profileName = args[0].AsString; InternalHandle callback = (args.Length == 2 ? args[1].KeepAlive() : null); if (!string.IsNullOrEmpty(profileName)) { if (callback != null && callback.IsFunction) { new Task(() => { try { callback.StaticCall(Engine.CreateValue(new ConnectionHelper(profileName))); } catch (Exception ex) { Log.Trace(ex.Message, ex.StackTrace, true); } }).Start(); } else { try { return(Engine.CreateValue(new ConnectionHelper(profileName))); } catch (Exception ex) { Log.Trace(ex.Message, ex.StackTrace, true); } } } } } catch (Exception ex) { Log.Trace(ex.Message, ex.StackTrace, true); } return(null); }