Hey everyone,
I've got some problems I really hope you could help me with.
1. Memory Managment... How can I reduce the amount of memory used by a script, or release the memory used? I null and delete all references when their not used, but it doesn't seem to help. Is there any way to run the garbage collector?
2. I need to know the width of a piece of text. For instance:
myLayer.innerHTML = "What is the width of this text?";
var width = myLayer.clientWidth; //Nope
width = myLayer.getBoundingClientRect().right;//Nope
3. Most important! I need to wait for an image to load. Like this:
var image = document.createElement("DIV");
image.src = "MyImageURL";
//I need the image dimension know so I want to
//wait here
while(!image.complete); //can't do this
I can't use any callback functions either, such as onload, as I need to know the image dimensions before the method runs out of scope. And I can't preload the images, as some are dynamically generated by the server. The most important, however, is to know the image dimensions.
I would REALLY appreciate some assistance! If you have any suggestions or questions, feel free to post.
Thanks on advance,
Nille
I've got some problems I really hope you could help me with.
1. Memory Managment... How can I reduce the amount of memory used by a script, or release the memory used? I null and delete all references when their not used, but it doesn't seem to help. Is there any way to run the garbage collector?
2. I need to know the width of a piece of text. For instance:
myLayer.innerHTML = "What is the width of this text?";
var width = myLayer.clientWidth; //Nope
width = myLayer.getBoundingClientRect().right;//Nope
3. Most important! I need to wait for an image to load. Like this:
var image = document.createElement("DIV");
image.src = "MyImageURL";
//I need the image dimension know so I want to
//wait here
while(!image.complete); //can't do this
I can't use any callback functions either, such as onload, as I need to know the image dimensions before the method runs out of scope. And I can't preload the images, as some are dynamically generated by the server. The most important, however, is to know the image dimensions.
I would REALLY appreciate some assistance! If you have any suggestions or questions, feel free to post.
Thanks on advance,
Nille