Replies: 1 comment 8 replies
-
Now that I think about it, I could perhaps SetValue that object normally and then set it as the prototype to the global object I'll try that first thing tomorrow |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With the new
TypeResolver
we can filter members. I use attributes to decide which methods can and can't be accessed. I'm looking for a way to use the same system to filter, compare (and provide) members in the global scope.Normally this is done using Engine.SetValue, but I'd prefer to also use attributes to decide which members of a "Global Object" should be exposed using the same TypeResolver.
Playing around it seemed like IReferenceResolver may be able to help me. Though I run into this problem like #947 where I can't return a method so it can be called.
This is a "short" version of what I'm trying:
global
given to the reference resolver above is an instance of this class which contains all my custom global variables and functions amongst functions I do not wish to shareThis works somewhat for properties and fields, but for members it seems more challenging since I can't return a method (like #947).
Is there a way to do what I want? I had a look at Jint/GlobalObject.cs, but it's sealed. Furthermore it seems that if I want to override Host.CreateGlobalObject I have to specify a HostFactory that provides my own host, but that feels like overkill (so I haven't tried).
Which direction would be preferred? Or is what I want not possible/desired?
If anythings unclear let me know. I had trouble keeping the question short.
Beta Was this translation helpful? Give feedback.
All reactions