Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-08-2003, 12:42 AM   PM User | #1
Skyzyx
Regular Coder

 
Skyzyx's Avatar
 
Join Date: Aug 2002
Location: Silicon Valley, CA
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
Skyzyx is on a distinguished road
Problem with Algorithm's Timer Class

Algorithm came up with an awesome Timer Class for Object-Oriented timeouts. He posted it here:
http://www.codingforums.com/showthre...threadid=10531

For the most part, it works great! However, I'm having problems with the clearTimeout() function.

I'm working on an OO Message Ticker script, that uses the Timer Class. The only real problem is that I have to invoke obj.clearTimeout(0) several times before it takes effect. Really, I'm not entirely sure what the parameter should be. Not passing anything seems to void the functionality of it.

There also seems to be an error that pops up in Mozilla, but doesn't seem to stall the script at all.

If anyone could take a look at my script and the bundled timer class, I'd appreciate it. I know that Beetle is familiar with it, as well as Algorithm (of course!).
Attached Files
File Type: zip mc5.zip (3.0 KB, 120 views)
__________________

Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.
Skyzyx is offline   Reply With Quote
Old 07-08-2003, 01:30 AM   PM User | #2
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
Well, without looking, let me say this. You must pass in the reference to the timeout
Code:
function SomeConstructor()
{
    this.timer = new Timer( this );
    this.timeout = this.timer.setTimeout( "someMethod", 1000 );
}

SomeConstructor.prototype.anotherMethod = function()
{
    this.timer.clearTimeout( this.timeout );
}
Got that?
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 07-08-2003, 01:43 AM   PM User | #3
Skyzyx
Regular Coder

 
Skyzyx's Avatar
 
Join Date: Aug 2002
Location: Silicon Valley, CA
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
Skyzyx is on a distinguished road
Thanks! Works like a charm!

I'm still getting this error in Gecko:

Code:
Warning: reference to undefined property Timer.set[i]
Source File: file:///C:/Oxygen/api/timer.js
Line: 107
I know it's in the Timer Class, and not part of my code, but it'd be nice to get this fixed... whatever it is.
__________________

Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.
Skyzyx is offline   Reply With Quote
Old 07-08-2003, 01:49 AM   PM User | #4
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
I don't know, but I have had bad luck running some complex JS w/o a webserver. I know it sounds weird, but try uploading that or running it on your localhost.

I'll look at the code, too.
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 PM.


Advertisement
Log in to turn off these ads.