/// <summary> /// Adds a instance of <see cref="EFFCVroomJsEngineFactory"/> to /// the specified <see cref="JsEngineFactoryCollection" /> /// </summary> /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param> /// <param name="settings">Settings of the Vroom JS engine</param> /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns> public static JsEngineFactoryCollection AddEFFCVroom(this JsEngineFactoryCollection source, EFFCVroomSettings settings) { if (source == null) { throw new ArgumentNullException("source"); } if (settings == null) { throw new ArgumentNullException("settings"); } source.Add(new EFFCVroomJsEngineFactory(settings)); return(source); }
/// <summary> /// Constructs an instance of adapter for the Vroom JS engine /// (cross-platform bridge to the V8 JS engine) /// </summary> /// <param name="settings">Settings of the Vroom JS engine</param> public EFFCVroomJsEngine(EFFCVroomSettings settings) { EFFCVroomSettings vroomSettings = settings ?? new EFFCVroomSettings(); try { _jsEngine = new OriginalJsEngine(vroomSettings.MaxYoungSpaceSize, vroomSettings.MaxOldSpaceSize); _jsContext = _jsEngine.CreateContext(); } catch (Exception e) { throw new JsEngineLoadException( string.Format(CoreStrings.Runtime_JsEngineNotLoaded, EngineName, e.Message), EngineName, EngineVersion, e); } }
/// <summary> /// Adds a instance of <see cref="EFFCVroomJsEngineFactory"/> to /// the specified <see cref="JsEngineFactoryCollection" /> /// </summary> /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param> /// <param name="configure">The delegate to configure the provided <see cref="EFFCVroomSettings"/></param> /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns> public static JsEngineFactoryCollection AddEFFCVroom(this JsEngineFactoryCollection source, Action <EFFCVroomSettings> configure) { if (source == null) { throw new ArgumentNullException("source"); } if (configure == null) { throw new ArgumentNullException("configure"); } var settings = new EFFCVroomSettings(); configure(settings); return(source.AddEFFCVroom(settings)); }
/// <summary> /// Constructs an instance of the Vroom JS engine factory /// </summary> /// <param name="settings">Settings of the Vroom JS engine</param> public EFFCVroomJsEngineFactory(EFFCVroomSettings settings) { _settings = settings; }