public static JavaScriptHostingConfig AddModuleFolder(this JavaScriptHostingConfig config, string scriptRootFolder) { ModuleLocator locator = new ModuleLocator(scriptRootFolder); config.ModuleFileLoaders.Add(locator.LoadModule); return(config); }
public ChakraContext CreateContext(JavaScriptHostingConfig config) { var result = createContext(createRuntime()); initContext(result, config); return(result); }
public TResult GetModuleClass <TResult>(string moduleName, string className, JavaScriptHostingConfig config) where TResult : IJSValueWrapper, new() { var jsvalue = GetModuleClass(moduleName, className, config); TResult result = new TResult(); result.SetValue(jsvalue); return(result); }
public ChakraContext CreateContext(JavaScriptHostingConfig config) { var result = createContext(createRuntime()); initContext(result, config); config.DebugAdapter?.Init(result.ServiceNode.GetService <IRuntimeDebuggingService>()); return(result); }
public static JavaScriptHostingConfig AddModuleFolder(this JavaScriptHostingConfig config, StorageFolder folder) { config.ModuleFileLoaders.Add((name) => { var t = loadModuleFromFolderAsync(folder, name); t.Wait(); return(t.Result); }); return(config); }
public static JavaScriptHostingConfig AddPlugin(this JavaScriptHostingConfig config, IPluginInstaller plugin) { return(config.AddPlugin((name) => { if (plugin.Name == name) { return plugin; } return null; })); }
public static JavaScriptHostingConfig AddModuleScript <T>(this JavaScriptHostingConfig config, string name, string script) { config.ModuleFileLoaders.Add((n) => { if (n == name) { return(script);; } return(null); }); return(config); }
public static JavaScriptHostingConfig AddModuleScript <T>(this JavaScriptHostingConfig config, string name, string script, string url = null) { config.ModuleFileLoaders.Add((n) => { if (n == name) { return(new ModuleInfo { SourceCode = script, Url = url }); } return(null); }); return(config); }
public Task <JSValue> GetModuleClassAsync(string proxyTemplate, string moduleName, string className, JavaScriptHostingConfig config) { return(Task.Factory.StartNew(() => { return GetModuleClass(proxyTemplate, moduleName, className, config); })); }
public JSValue GetModuleClass(string proxyTemplate, string moduleName, string className, JavaScriptHostingConfig config) { var context = CreateContext(config); string projectTo = "X" + Guid.NewGuid().ToString().Replace('-', '_'); return(context.ProjectModuleClass(proxyTemplate, moduleName, className, config.LoadModule)); }
public JSValue GetModuleClass(string moduleName, string className, JavaScriptHostingConfig config) { var context = CreateContext(config); return(context.ProjectModuleClass(moduleName, className, config.LoadModule)); }
public virtual void RunScript(string script, JavaScriptHostingConfig config) { CreateContext(config).RunScript(script); }
protected virtual void initContext(ChakraContext context, JavaScriptHostingConfig config) { PluginManager pluginManager = new PluginManager(context, config.LoadPlugin); }
public static JavaScriptHostingConfig EnableHosting(this JavaScriptHostingConfig config, ResolveConfigFunction resolve) { ModuleHosting hosting = new ModuleHosting(resolve); return(config.AddPlugin(hosting)); }
public Task <TResult> GetModuleClassAsync <TResult>(string proxyTemplate, string moduleName, string className, JavaScriptHostingConfig config) where TResult : IJSValueWrapper, new() { return(Task.Factory.StartNew(() => { return GetModuleClass <TResult>(proxyTemplate, moduleName, className, config); })); }
public static JavaScriptHostingConfig AddModuleFolderFromCurrentAssembly(this JavaScriptHostingConfig config) { string folder = new System.IO.FileInfo(System.Reflection.Assembly.GetCallingAssembly().Location).DirectoryName; return(config.AddModuleFolder(folder)); }
public static JavaScriptHostingConfig Clone(this JavaScriptHostingConfig config) { return(new JavaScriptHostingConfig(config)); }
public static JavaScriptHostingConfig AddPlugin <T>(this JavaScriptHostingConfig config) where T : IPluginInstaller, new() { return(config.AddPlugin(new T())); }
public static JavaScriptHostingConfig AddPlugin(this JavaScriptHostingConfig config, LoadPluginInstallerFunction loadCallback) { config.PluginLoaders.Add(loadCallback); return(config); }
public JavaScriptHostingConfig(JavaScriptHostingConfig source) : this() { PluginLoaders.AddRange(source.PluginLoaders); ModuleFileLoaders.AddRange(source.ModuleFileLoaders); }
public static JavaScriptHostingConfig AddPluginFolder(this JavaScriptHostingConfig config, string folderPath) { var loader = new DirectoryLoader(folderPath); return(config.AddPluginLoader(loader.Load)); }