Пример #1
0
        public void Start()
        {
            if (_engineInstance != null)
            {
                return;
            }

            _engineInstance = _jsEnginePool.GetInstance();
        }
Пример #2
0
        public void Stop()
        {
            if (_engineInstance == null)
            {
                throw new InvalidOperationException("Stop() cannot be called when the engine is not running");
            }

            _jsEnginePool.ReleaseInstance(_engineInstance);

            _engineInstance = null;
        }
Пример #3
0
        public void ReleaseInstance(JSEngineInstance instance)
        {
            instance.Clean();

            Task.Run(() => _availableEngines.Enqueue(instance));
        }