public JSApplication(string rootDir = null) { if (rootDir == null) { rootDir = AppDomain.CurrentDomain.BaseDirectory; } Settings = new Settings(rootDir); Watch = new Watch(); Cache = new Cache(); Engine = new Engine(); Engine.Init(); Engine.RegisterClass(typeof(External.HTTP)); Engine.RegisterClass(typeof(External.SQL)); Engine.RegisterClass(typeof(External.IO)); Engine.RegisterClass(typeof(External.Log)); Engine.RegisterClass(typeof(External.Session)); Engine.RegisterClass(typeof(External.XDoc)); Engine.RegisterFunctions(typeof(External.Functions)); Connections = new Connections(Watch, Settings); Config = new External.Config(Watch, Engine.Scope, Settings); XDocService = new XDocServices.XDocService(); }
public JSApplication(string rootDir, Action <JSApplication> afterStart, Action <Exception, ErrorStage> onError) { if (rootDir == null) { // Set the root directory to the application base directory if not specified rootDir = AppDomain.CurrentDomain.BaseDirectory; } // Create managers Settings = new Settings(rootDir); Cache = new Cache(); Connections = new Connections(Settings); XDocService = new XDocServices.XDocService(); // Store callbacks _afterStart = afterStart; _onError = onError; // Start the proxy _proxy = new Proxy(Settings.DebugPort, () => { return(_engineDebugPort); }); _proxy.Start(); // Start the engine Restart(); // Create thread for event loop var eventThread = new Thread(EventLoop); eventThread.Start(); // Create thread for file update checking var fileThread = new Thread(FileLoop); fileThread.Start(); }