/// <summary> /// Add a static JSX file. The name is fed to <see cref="ScriptContentLoader"/> to get the contents of the script. /// Defaults to loading the local file with name as path. /// This content is then compiled to JS using Babel with react addin as a compiler. /// Finally the JS script is added to the <see cref="ReactRepository"/>. /// </summary> /// <param name="name">Locator of a JSX script resource. Usually a file path.</param> public void AddJsx(string name) { CheckNonFrozen(); n++; using (var e = GetBabelPool().Engine) { var JSX = ScriptContentLoader(name); var compiled = e.Evaluate("transformCode", JSX); ReactRepository.AddScriptContent(compiled.ToString(), Sanitize(name, n)); } }
private void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { var seq = e.UserState as int?; var client = sender as WebClient; ScriptRepository.AddScriptContent(e.Result, client.BaseAddress, seq.Value); client.DownloadStringCompleted -= Client_DownloadStringCompleted; client.Dispose(); cd.Signal(); }