Initial state

This commit is contained in:
SteveSandersonMS
2015-11-02 10:30:36 -08:00
parent 0e1fa2e09d
commit f693bd60e3
110 changed files with 6722 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
using System.Threading.Tasks;
namespace Microsoft.AspNet.NodeServices.React
{
public static class ReactRenderer
{
private static StringAsTempFile nodeScript;
private static NodeInstance nodeInstance = new NodeInstance();
static ReactRenderer() {
// Consider populating this lazily
var script = EmbeddedResourceReader.Read(typeof (ReactRenderer), "/Content/Node/react-rendering.js");
nodeScript = new StringAsTempFile(script); // Will be cleaned up on process exit
}
public static async Task<string> RenderToString(string moduleName, string exportName, string baseUrl) {
return await nodeInstance.InvokeExport(nodeScript.FileName, "renderToString", new {
moduleName,
exportName,
baseUrl
});
}
}
}