Isolated Engine #1406
Replies: 3 comments 3 replies
-
I would like to add that It's not difficult to copy these lines and rework them for ShadowRealm Lines 177 to 216 in 4839fd1 It works. But I don't know about Shadow Realm architecture and its possible side effects. Any thoughts? public ShadowRealm SetValue(string name, Delegate value)
{
_shadowRealm.GlobalObject.FastSetProperty(name, new PropertyDescriptor(new DelegateWrapper(_engine, value), true, false, true));
return this;
}
public ShadowRealm SetValue(string name, string value)
{
return SetValue(name, JsString.Create(value));
}
public ShadowRealm SetValue(string name, double value)
{
return SetValue(name, JsNumber.Create(value));
}
public ShadowRealm SetValue(string name, int value)
{
return SetValue(name, JsNumber.Create(value));
}
public ShadowRealm SetValue(string name, bool value)
{
return SetValue(name, value ? JsBoolean.True : JsBoolean.False);
}
public ShadowRealm SetValue(string name, JsValue value)
{
_shadowRealm.GlobalObject.Set(name, value);
return this;
}
public ShadowRealm SetValue(string name, object obj)
{
var value = obj is Type t
? TypeReference.CreateTypeReference(_engine, t)
: JsValue.FromObject(_engine, obj);
return SetValue(name, value);
} |
Beta Was this translation helpful? Give feedback.
-
One more thing regarding ShadowReadm: |
Beta Was this translation helpful? Give feedback.
-
@lahma @MaxGrekhov Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to optimize the usage of Engine. And I want to have some sort of isolated engine. This topic has come up a few times already, and I think that the last suggested approach is ShadowRealm. The only problem I see is that It doesn't provide any API to set external value.
It would be nice to have
Did I miss something? Will it allow to make Engine static or singleton?
Beta Was this translation helpful? Give feedback.
All reactions