/    Sign up×
Community /Pin to ProfileBookmark

stopEverything()

I have a query but im not going to paste any code, so I would be gratefull for what little help anyone can offer.

Ive have written a dhtml dom script, that interfaces with my main xhtml script by calling methods and passing indexes, these methods use clearInterval() and clearTimeout() to stop the script and restart it based on the new indexes.

The problem I am getting is if your quick you can trigger the method repeatidly and even though the code is logically written, you can get it to initiate more lines of processing (or trains of thought if you get my meaning) and it cartwheels away into madness getting faster.

What I need ideally is a method called stopEverything() that just stops all javascript processing straight away so that incase some get through without the intervals being cleared it wont matter cos the next call to stop everything will still stop the previous paths of processing but there doesnt seem to be any suitable in built functionality for such.

Is there a way to do this? I already have my interval variables accessable to all methods and it works well enough to be used because it only breaks if you be an ass with it but I would like it to be perfect.

Waylander.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzNov 01.2005 — Add a global boolean variable that has to be set to true for the functions to do anything.
Copy linkTweet thisAlerts:
@WaylanderauthorNov 01.2005 — Ive got one thats actually how it works, I have it pausing onhover and resume onmouseout, using a global primative boolean called holdPosition.

In the mouse out method I have to set the variable back to false to have the script resume. I tried to use that variable and then another one to do it but the problem makes the same function run more than once at the same time, it cant differentiate between the problem ones and the right one so the script stops completely...

hmmm.

Waylander.
×

Success!

Help @Waylander spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...