J
Jake Barnes
In the function below, the reset() method has no effect. What is the
correct way to ensure that
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox is
empty?
function getArrayOfElementsForCommunicationBox() {
// 02-12-06 - I'm thinking it would be nice to have a global
object that contains two
// arrays, plus get and set methods for those arrays. Functions
like setText() can use
// these methods to specify what the dialog box should look like,
and then setText()
// can call askForInput() which will show the dialog box. These
two arrays, below
// specify what HTML elements should be placed in the
communication box.
//
// 02-13-06 - PLEASE NOTE - this function is different from
storeReferencesToHTMLSafely
// in that manages references to HTML blocks whereas this carries
strings of ids and
// initial text that should fill in the communication box form.
var objectForAccessingArrayOfItemsForCommunicationBox = new
Object();
var
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox =
new Object();
var singletonCallBackAction = new Object();
objectForAccessingArrayOfItemsForCommunicationBox.set =
function(idOfElement, initialValue) {
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox[idOfElement]
= initialValue;
}
objectForAccessingArrayOfItemsForCommunicationBox.get =
function() {
return
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox;
}
objectForAccessingArrayOfItemsForCommunicationBox.reset =
function() {
var
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox =
new Object();
}
objectForAccessingArrayOfItemsForCommunicationBox.setCallBack =
function(callBack) {
singletonCallBackAction["callBack"] = callBack;
}
objectForAccessingArrayOfItemsForCommunicationBox.getCallBack =
function() {
var callBack = singletonCallBackAction["callBack"];
return callBack;
}
return objectForAccessingArrayOfItemsForCommunicationBox;
}
var arrayOfElementsForCommunicationBox =
getArrayOfElementsForCommunicationBox();
arrayOfElementsForCommunicationBox.set("inputBox", "Please type your
address here.");
arrayOfElementsForCommunicationBox.reset(); // var still has values in
it, even after this
correct way to ensure that
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox is
empty?
function getArrayOfElementsForCommunicationBox() {
// 02-12-06 - I'm thinking it would be nice to have a global
object that contains two
// arrays, plus get and set methods for those arrays. Functions
like setText() can use
// these methods to specify what the dialog box should look like,
and then setText()
// can call askForInput() which will show the dialog box. These
two arrays, below
// specify what HTML elements should be placed in the
communication box.
//
// 02-13-06 - PLEASE NOTE - this function is different from
storeReferencesToHTMLSafely
// in that manages references to HTML blocks whereas this carries
strings of ids and
// initial text that should fill in the communication box form.
var objectForAccessingArrayOfItemsForCommunicationBox = new
Object();
var
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox =
new Object();
var singletonCallBackAction = new Object();
objectForAccessingArrayOfItemsForCommunicationBox.set =
function(idOfElement, initialValue) {
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox[idOfElement]
= initialValue;
}
objectForAccessingArrayOfItemsForCommunicationBox.get =
function() {
return
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox;
}
objectForAccessingArrayOfItemsForCommunicationBox.reset =
function() {
var
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox =
new Object();
}
objectForAccessingArrayOfItemsForCommunicationBox.setCallBack =
function(callBack) {
singletonCallBackAction["callBack"] = callBack;
}
objectForAccessingArrayOfItemsForCommunicationBox.getCallBack =
function() {
var callBack = singletonCallBackAction["callBack"];
return callBack;
}
return objectForAccessingArrayOfItemsForCommunicationBox;
}
var arrayOfElementsForCommunicationBox =
getArrayOfElementsForCommunicationBox();
arrayOfElementsForCommunicationBox.set("inputBox", "Please type your
address here.");
arrayOfElementsForCommunicationBox.reset(); // var still has values in
it, even after this