Hi ClearScript,
when I execute JavaScript code I have to add objects, types etc. before I call execute. The JavaScript code itself has not influence which objects or types are available.
But what I want is that the JavaScript Code itself has got an option to define what objects / types etc. it needs an the runtime has the option to add it, like following pseudocode
1st. the bootstrap
```
using (var engine = new V8ScriptEngine())
{
engine.AddHostObject("using", MyApp.PackageManager);
... ' something what is additionally need
engine.Execute(myscript);
}
```
2nd, the JavaScript
```
using.AddType("System.Environment");
var username = Enviroment.UserName;
```
3rd, the "MyApp.PackageManager"
```
static void AddType(string name)
{
_ V8ScriptEngine.Current.AddHostType(name);_
}
```
I know, there is no option like V8ScriptEngine.Current at the moment. But is there another way to do this?
Best regards,
Torsten
when I execute JavaScript code I have to add objects, types etc. before I call execute. The JavaScript code itself has not influence which objects or types are available.
But what I want is that the JavaScript Code itself has got an option to define what objects / types etc. it needs an the runtime has the option to add it, like following pseudocode
1st. the bootstrap
```
using (var engine = new V8ScriptEngine())
{
engine.AddHostObject("using", MyApp.PackageManager);
... ' something what is additionally need
engine.Execute(myscript);
}
```
2nd, the JavaScript
```
using.AddType("System.Environment");
var username = Enviroment.UserName;
```
3rd, the "MyApp.PackageManager"
```
static void AddType(string name)
{
_ V8ScriptEngine.Current.AddHostType(name);_
}
```
I know, there is no option like V8ScriptEngine.Current at the moment. But is there another way to do this?
Best regards,
Torsten