Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22836

Re: Shutting script down when leaving page

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail
From Xox <etacx18@etaoin.com>
Newsgroups comp.lang.javascript
Subject Re: Shutting script down when leaving page
Date Tue, 28 Jan 2014 05:03:45 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 116
Message-ID <lc7dnh$n8c$3@reader1.panix.com> (permalink)
References <lc4jit$bmm$1@reader1.panix.com> <R5ydnabdDqqqm3vPnZ2dnUVZ_tqdnZ2d@westnet.com.au> <6507961.N3xZG9CObR@PointedEars.de> <270120141041247876%timstreater@greenbee.net> <lc6cta$n8c$1@reader1.panix.com> <10703674.pIetZOEVdU@PointedEars.de>
NNTP-Posting-Host pool-74-108-80-123.nycmny.east.verizon.net
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace reader1.panix.com 1390885425 23820 74.108.80.123 (28 Jan 2014 05:03:45 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Tue, 28 Jan 2014 05:03:45 +0000 (UTC)
User-Agent Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2)
Xref csiph.com comp.lang.javascript:22836

Show key headers only | View raw


On Tue, 28 Jan 2014 01:20:22 +0100, Thomas 'PointedEars' Lahn wrote:

> Xox wrote:
> ^^^
> Please fix this.

What would you prefer?
 
>> I am sorry my vocabulary offended.
> 
> ACK.
> 
>> (Although I don't know what the statelessness of HTTP has to do with
>> anything.)
> 
> You told of “pages”, meaning documents, being “active”, which is utter
> nonsense with a stateless protocol.  The document resource is served,
> i.e. transferred from the server to the client, and that is it.  Only a
> client-
> side *script* can be “active”, i.e. running.

What I meant, of course, is that the 'page' is
present and visible in the browser and that the
scripts are (possibly) running, regardless of how
it got there, via HTTP or reading a file.  It's a 
little metonymy, like 'a hot cup of coffee' -- actually, 
the cup is not made of hot coffee, it's just the 
container.  Actually the page/document is not
active, but it contains material which is being
displayed and script which are running, maybe.
 
>> I will explain in another way.  I have a page which has some

> You do not have a page, you have a document.

Well, actually, I wrote a 'page' of code, which
implies a document, but when I wrote it, it was a
page, that is, an HTML file, which happened to include 
scripts.  That gets turned into a document when it is 
read and interpreted, but it was not a document in 
the sense I think we are using this word when I wrote
it.

> 
>> Javascript functions on/in it.
> 
> There is no “Javascript”, but, for the sake of discussion, let us
> continue under the assumption that you wrote “JavaScript”, even though
> even that term is insufficient to describe the situation.

Out of curiosity, I wonder what you would prefer.
I thought I was writing Javascript, I used grammar
widely attributed to Javascript, and hence I 
wrote my question in a newsgroup called, of all
things, comp.lang.javascript, where we are having
this discussion, so you can see how I might have
gotten that impression.
 
>> Some of the functions are repeatedly called/started/invoked/run by
>> setInterval or setTimeout.  They look to see whether certain objects
>> etc.
>> are present and where they are, and may move or create other objects
>> accordingly. There could be a lot of these objects.  The functions
>> could thus consume a lot of resources.
>> 
>> Now suppose the browser navigates to another page.
> 
> s/browser/user/
> s/page/resource/
> 
>> I am wondering whether some browsers may continue to execute the
>> aforesaid function invocations anyway.
> 
> Some do.
> 
>> I would think not,
> 
> Why?

I may be showing my age, but back in the day, if you
didn't need a resource, you got rid of it -- you freed
memory, and stopped processes/threads/tasks/transactions
that were no longer useful (in this case, to affect what
the user sees/hears etc.)  Conceded, you might keep the
material around if you thought it could be revisited in
the near future.  But indefinite retention of the resources
seems likely to bog down the supporting platform.

But maybe nobody cares any more.  I read somewhere that
Firefox kept allocated memory around indefinitely until
the process(es) terminated.  Like all day or all week, if
the user didn't quit.

>> but stranger things have been coded.
> 
> Indeed.
>  
>> I could make a list of the ids returned by setInterval and run
>> clearInterval against each on the onunload event,
> 
> Good idea.
> 
>> but I'd just as soon not bother if it's superfluous.
> 
> ACK.  (Some people with less understanding of English appear to have
> misunderstood you here.  Keep in mind that this is an international
> newsgroup, so it is best to avoid the more peculiar idioms of the
> language in order not to be misunderstood.)
>  
>> Does anyone know?
> 
> Yes.

It looks like you have given the answer I was looking
for, although it's not what I wanted to hear.  So it
goes.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Shutting script down when leaving page Xox <etacx18@etaoin.com> - 2014-01-27 03:25 +0000
  Re: Shutting script down when leaving page Andrew Poulos <ap_prog@hotmail.com> - 2014-01-27 18:08 +1100
    Re: Shutting script down when leaving page "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-27 10:23 +0100
    Re: Shutting script down when leaving page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-27 11:21 +0100
      Re: Shutting script down when leaving page Tim Streater <timstreater@greenbee.net> - 2014-01-27 10:41 +0000
        Re: Shutting script down when leaving page Xox <etacx18@etaoin.com> - 2014-01-27 19:43 +0000
          Re: Shutting script down when leaving page "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-27 20:53 +0100
            Re: Shutting script down when leaving page Xox <etacx18@etaoin.com> - 2014-01-27 20:52 +0000
          Re: Shutting script down when leaving page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-28 01:20 +0100
            Re: Shutting script down when leaving page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-28 01:24 +0100
            Re: Shutting script down when leaving page "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-01-27 18:44 -0800
            Re: Shutting script down when leaving page Xox <etacx18@etaoin.com> - 2014-01-28 05:03 +0000
              Re: Shutting script down when leaving page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-28 11:33 +0100
                Re: Shutting script down when leaving page Xox <etacx18@etaoin.com> - 2014-01-28 19:40 +0000
            Re: Shutting script down when leaving page "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-28 09:31 +0100
      Re: Shutting script down when leaving page Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-27 21:37 +0100
        Re: Shutting script down when leaving page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-28 00:10 +0100
          Re: Shutting script down when leaving page Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-28 00:54 +0100

csiph-web