Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Global window object

0
0
So another question in regards to simulating the window object in a browser:

I have created a DynamicObject "window" which uses the GlobalMembers method which is great (access to location, screen, document, etc as expected). The thing I am trying to accomplish now is to allow dynamic properties set on the global host to be reflected in the window object and visa-versa.

e.g.

answer = 42;
console.log(window.answer); // 42

So one direction works:
window.answer = 42;

Evaluate("answer") = 42;

But this:
answer = 42;

Evaluate("window.answer") = undefined

I tried to override GetDynamicMemberNames() in my window object to include dynamic properties from the global context but that results in a stack overflow. Is there a way my window object can retrieve a list of properties from the global object without recursively coming back to itself?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images