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,38 @@
using System;
using System.Threading.Tasks;
namespace Microsoft.AspNet.NodeServices {
public class NodeInstance : IDisposable {
private readonly NodeHost _nodeHost;
public NodeInstance(NodeHostingModel hostingModel = NodeHostingModel.Http) {
switch (hostingModel) {
case NodeHostingModel.Http:
this._nodeHost = new HttpNodeHost();
break;
case NodeHostingModel.InputOutputStream:
this._nodeHost = new InputOutputStreamNodeHost();
break;
default:
throw new ArgumentException("Unknown hosting model: " + hostingModel.ToString());
}
}
public Task<string> Invoke(string moduleName, params object[] args) {
return this.InvokeExport(moduleName, null, args);
}
public async Task<string> InvokeExport(string moduleName, string exportedFunctionName, params object[] args) {
return await this._nodeHost.Invoke(new NodeInvocationInfo {
ModuleName = moduleName,
ExportedFunctionName = exportedFunctionName,
Args = args
});
}
public void Dispose()
{
this._nodeHost.Dispose();
}
}
}