예제 #1
0
        public static void Reload()
        {
            if (!_isInitialized)
            {
                throw new ApplicationException("Not yet initialized. Can't reload.");
            }

            var _webpackBuilder = new WebpackBuilder(_httpServerUtility);

            s_instance     = _webpackBuilder.Build(_config);
            _isInitialized = true;
        }
예제 #2
0
        public static void Initialize(HttpServerUtilityBase httpServerUtility, WebpackConfig config)
        {
            if (_isInitialized)
            {
                throw new ApplicationException("Already initialized");
            }

            _httpServerUtility = httpServerUtility ?? throw new ArgumentNullException(nameof(httpServerUtility));
            _config            = config;
            var _webpackBuilder = new WebpackBuilder(_httpServerUtility);

            s_instance     = _webpackBuilder.Build(_config);
            _isInitialized = true;
        }
        /// <summary>
        /// Configures webpack.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="webpack">The webpack instance.</param>
        /// <exception cref="System.ArgumentNullException">
        /// application
        /// or
        /// webpack
        /// </exception>
        internal static void ConfigureWebpack(this HttpApplicationStateBase application, IWebpack webpack)
        {
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }
            if (webpack == null)
            {
                throw new ArgumentNullException(nameof(webpack));
            }

            application.Lock();
            try
            {
                application[WebpackApplicationKey] = webpack;
            }
            finally
            {
                application.UnLock();
            }
        }