home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
COMMON
/
js
/
RRManager.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
3KB
|
95 lines
function RRManager ( )
{
this.requests = new ActiveXObject("Scripting.Dictionary");
this.uniqueID = 0;
this.cancelTimerID = 0;
this.max =10;
}
var gblRRManager = new RRManager ();
RRManager.prototype.resetData = function () { this.requests.RemoveAll(); };
RRManager.prototype.register = function ( request)
{
if (gblRRManager.isAborting) { return; };
if (!request) { return; }
if (this.requests.Exists(request.getID())) {
var e = new Error();
e.description = "Already registered a request with this id";
throw e;
};
if (this.requests.Count < this.max)
{
this.uniqueID++;
request.setID(this.uniqueID);
request.isRegistered = true;
this.requests.Add(this.uniqueID, request);
} else {
return -500;
};
return (this.uniqueID);
};
RRManager.prototype.unregister = function ( request)
{
if (!request) { return; };
if (this.requests.Exists(request.getID())) {
this.requests.Item(request.getID()) = null;
this.requests.Remove(request.getID());
request.setID(-100);
request.isRegistered = false;
};
request = null;
};
RRManager.prototype.cancelTimerID = 0;
RRManager.prototype.doCancel = function ( )
{
System.handleError = function() { return true; }
top.document.all.divDialogBox.setCapture(true);
window.external.PumpMessages();
if (!gblRRManager.isAborting) {
gblRRManager.isAborting = true;
if (this.requests.Count) {
for (var idx = (this.requests.Count -1); idx >= 0; idx--)
{
try {
this.requests.Items().getItem(idx).abort();
} catch (e) {
};
};
};
gblRRManager.isGoingAway = (gblRRManager.onCancel()) ? true : false;
if (gblRRManager.isGoingAway) {
//if (gblRRManager.cancelTimerID == 0) {
// gblRRManager.cancelTimerID = setTimeout(function() { RRManager.goAway(); }, 85);
RRManager.goAway();
//};
} else {
gblRRManager.onCancel = RRManager.prototype.onCancel;
gblRRManager.isAborting = false;
System.GUI.loadingDialog.hide();
System.handleError = SystemClass.prototype.handleError;
top.document.releaseCapture(true);
};
};
};
RRManager.prototype.onCancel = function() { return true };
RRManager.prototype.resetOnCancel = function() { this.onCancel = RRManager.prototype.onCancel; };
RRManager.oldRRproto = null;
RRManager.goAway = function()
{
if (gblRRManager.isGoingAway && gblRRManager.isAborting) {
var currentUserName = System.Session.getUserName();
var currentPassword = System.Session.getPassword();
System.GUI.clearLeftNav();
System.GUI.playTransition(true, false);
System.GUI.setTitle(System.GUI.Screens["1"].getTitle());
top.document.all.screen_bg.src = "../../../fe/NHL/images/background/main_menu.jpg"
System.GUI.setLocation(System.GUI.Screens["1"].getScreenSrc());
System.GUI.currentScreenObj = System.GUI.Screens["1"];
System.Session.logout();
gblRRManager.onCancel = RRManager.prototype.onCancel;
gblRRManager.isAborting = false;
gblRRManager.cancelTimerID = 0;
System.handleError = SystemClass.prototype.handleError;
top.document.releaseCapture();
};
};