views:

641

answers:

1

Is there anyway to access intercept when an item gets added to a Scripting.Dictionary or hook up an event in javascript??

Do they have accessor methods eg. set, get or not?

var test = new ActiveXObject("Scripting.Dictionary");
test("a") = "test";

I need to do some more tasks when this is set.

Any help would be greatly appreciated.

+1  A: 

The short answer is: no, sorry.

However the question does arise why are you using Scripting.Dictionary in JScript?

var test = {};  test["a"] = "test";

I'm sorry its not all that helpful, you can't intercept a Scripting.Dictionary or the more Javascript traditional use of an object as an associtive array.

However you could probably build a Javascript class that wraps either of these so you can implement an event system yourself. Its a lot more work than you were hoping for though.

AnthonyWJones
I'm using it because i want to override the Session dictionary object, which means i won't have to change over 1000 pages using the round bracket syntax of a dictionary object.
Schotime
Session as in ASP Session?
AnthonyWJones
Yes. ASP session. Trying to migrate to ASP.net so the first thing is to move all the Session variables to Asp.net.
Schotime
Do your 1000 pages have a common include page at the top? Your best would be to emulate the Session object wholesale and replace the Session identifier with that.
AnthonyWJones
Yeah....thats what i'm trying to do. but its a bit hard when you can't use the dictionary round brackets
Schotime
Hmm... I'm confused you are trying to emulate ASP Session object in ASP.NET and have server-side script run in JScript? You are trying to get ASP pages to run as ASPX with minimal changes?
AnthonyWJones
Well firstly i'm just trying to store all Session variables on ASP.net to take advantage of stateserver and make migration easier in the future. Have it working now so that all Session variables in our classic asp app are stored on Asp.net now. Gets them via Xhttp call on every request.
Schotime