File tree Expand file tree Collapse file tree
src/ClearScript.Manager.WebDemo/Controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,5 +6,8 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\archive.ps1;
66powershell -NoProfile -ExecutionPolicy unrestricted -Command " & {.\package.ps1 -PackageName 'ClearScript.Manager'; exit $error.Count}"
77
88
9+ powershell -NoProfile -ExecutionPolicy unrestricted -Command " & {.\package.ps1 -PackageName 'ClearScript.Manager.Http'; exit $error.Count}"
10+
11+
912
1013pause
Original file line number Diff line number Diff line change @@ -7,4 +7,7 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\archive.ps1;
77powershell -NoProfile -ExecutionPolicy unrestricted -Command " & {.\publish.ps1 -PackageName 'ClearScript.Manager'; exit $error.Count}"
88
99
10+ powershell -NoProfile -ExecutionPolicy unrestricted -Command " & {.\publish.ps1 -PackageName 'ClearScript.Manager.Http'; exit $error.Count}"
11+
12+
1013pause
Original file line number Diff line number Diff line change 77using System . Threading . Tasks ;
88using System . Web . Http ;
99using ClearScript . Manager . WebDemo . Models ;
10+ using Microsoft . ClearScript ;
11+ using Microsoft . ClearScript . V8 ;
1012
1113namespace ClearScript . Manager . WebDemo . Controllers
1214{
@@ -28,18 +30,22 @@ public string Get(int id)
2830 public async Task < dynamic > Post ( [ FromBody ] Script script )
2931 {
3032 var scriptId = Guid . NewGuid ( ) ;
31- using ( var scope = new ManagerScope ( ) )
32- {
33+ // using (var scope = new ManagerScope())
34+ // {
3335 //dynamic host = new ExpandoObject();
3436 var host = new TestModel ( ) ;
3537 var option = new ExecutionOptions
3638 {
3739 HostObjects = new List < HostObject > { new HostObject { Name = "host" , Target = host } }
3840 } ;
39- await scope . RuntimeManager . ExecuteAsync ( scriptId . ToString ( ) , script . Text , option ) ;
41+
42+ var engine = new V8ScriptEngine ( ) ;
43+ engine . AddHostObject ( "host" , HostItemFlags . None , host ) ;
44+ engine . Execute ( script . Text ) ;
45+ //await scope.RuntimeManager.ExecuteAsync(scriptId.ToString(), script.Text, option);
4046
4147 return host ;
42- }
48+ // }
4349 }
4450
4551 // PUT api/values/5
You can’t perform that action at this time.
0 commit comments