Does javascript have a stop() method like Java applets?

T

Tom

A Java applet has two methods stop() and destroy() that get called
when the user moves to a different page. Does javascript have
anything similar?

thanks
tom
 
K

kaeli

A Java applet has two methods stop() and destroy() that get called
when the user moves to a different page. Does javascript have
anything similar?

When the user moves to a different page? No.
You can catch the onUnload event, but it's not that good for anything.

An applet needs a stop and destroy because it's always running and it
needs to clean up after itself when it's no longer needed. Javascript is
completely different.

--
--
~kaeli~
If a chicken and a half can lay an egg and a half in a day
and a half, how long would it take for a monkey with a
wooden leg to kick the dill seeds out of a pickle?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
T

Thomas 'PointedEars' Lahn

Tom said:
A Java applet has two methods stop() and destroy() that get called
when the user moves to a different page. Does javascript have
anything similar?

From the Java 1.4.2 API documentation:

| destroy()
| Called by the browser or applet viewer to inform this applet
| that it is being reclaimed and that it should destroy any
| resources that it has allocated.
|
| [...]
| stop()
| Called by the browser or applet viewer to inform this applet
| that it should stop its execution.

Why do you require anything similar in client-side JavaScript?

Almost all references are tied to the current document, that is, they
do not longer exist if the document resource is changed. The script
engine's garbage collector will automatically free memory allocated
for objects and other data if there are no more references to them and
the script engine stops execution as soon as the execution context that
it is invoked for ends (but it preserves references to the allocated
memory).


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top