Hi All,
I'm working on an application that basically does the following:
1) Monitors windows for a new browser window (or new tab)
2) If a legacy data base interface is opened, I inject javascript on the page that sends back information to my application to create logs for the db user.
I do this by
1) On application load I expose a simple rest service.
2) When I detect a browser window is navigated to the correct page, I instantiate a new object that then injects the JS code and waits for a call back from the rest service.
This works pretty nice right now, every time I get a call back on the service, I just send it along to my object. If I detect a navigation away from the db page or a window close I dispose of my object.
______________
NOW. I need to handle 2 or more concurrent web pages.
My initial thought is still only expose a single rest service and pass unique identifiers for each object that's created. Then have a dictionary of unique IDs that map to references to my object instances.
1) is this an even remotely good or acceptable coding practice? If not, please suggest a better route.
2) how do I handle the dictionary of my references if I detect that the screen has navigated away and I need to dispose of my object? I know I can't remove the object from the dictionary in the object.dispose. (right?? :-) )
Any other thoughts?
Nick
I'm working on an application that basically does the following:
1) Monitors windows for a new browser window (or new tab)
2) If a legacy data base interface is opened, I inject javascript on the page that sends back information to my application to create logs for the db user.
I do this by
1) On application load I expose a simple rest service.
2) When I detect a browser window is navigated to the correct page, I instantiate a new object that then injects the JS code and waits for a call back from the rest service.
This works pretty nice right now, every time I get a call back on the service, I just send it along to my object. If I detect a navigation away from the db page or a window close I dispose of my object.
______________
NOW. I need to handle 2 or more concurrent web pages.
My initial thought is still only expose a single rest service and pass unique identifiers for each object that's created. Then have a dictionary of unique IDs that map to references to my object instances.
1) is this an even remotely good or acceptable coding practice? If not, please suggest a better route.
2) how do I handle the dictionary of my references if I detect that the screen has navigated away and I need to dispose of my object? I know I can't remove the object from the dictionary in the object.dispose. (right?? :-) )
Any other thoughts?
Nick