Visible function and Timeouts

47 views
Skip to first unread message

John Tregoning

unread,
Sep 30, 2010, 1:59:50 PM9/30/10
to FuncUnit
Hi,

First of all congrats on such an awesome project, it really is truly
epic.

Is there a way to set the timeout for the visible function? at the
moment it seems to be hardcoded at 12 seconds. Unfortunately some
pages can take more than 12 seconds to load (e.g: CMS stuff) I am
getting round this problem by using S.wait. but a more elegant and
robust solution would be to increase the timeout.

Demo: http://s3.johntregoning.com/funcUnit/visible/funcunit.html

PS: I tried to work out what the visible method does, I found myself
looking at this:

<code>
visible : function(callback){
var self = this,
sel = this.selector,
ret;
this.selector += ":visible"
if(true){
return this.size(function(size){
return size > 0;
}, function(){
self.selector = sel;
callback && callback();
})
}else{
ret = this.size() > 0;
this.selector = sel;
return ret;
}

}
</code>

I can't see why you need the if/else statement, if(true) surely it is
always true and the else never gets executed or, (more likely) I am
just not getting what this code is doing.

Cheers.

JT.

Brian Moschel

unread,
Sep 30, 2010, 2:08:19 PM9/30/10
to func...@googlegroups.com
You are right, that code looks like it was meant to be temporary.

If you're waiting for a page to load, you should be passing a timeout value to open:

open: function( path, callback, timeout )

What is your test waiting on?

- Brian
--
Brian Moschel

Jupiter Consulting
\Development\Training\Support
847-727-1609
brian....@gmail.com

John Tregoning

unread,
Oct 1, 2010, 8:24:06 AM10/1/10
to FuncUnit
Sorry, I didn't explain myself. The page loads fine with no problem.
The problem is that once the page loads there is a ajax request into a
(very) slow data/process intensive service and then that data is re-
arranged into a table. This whole process will/can take more than 12
seconds.

Technically I guess this is a feature request: It would be nice to be
able to set a timeout for the visible, invisible, exist, and missing
methods.

Thanks

JT.

On Sep 30, 7:08 pm, Brian Moschel <brian.mosc...@gmail.com> wrote:
> You are right, that code looks like it was meant to be temporary.
>
> If you're waiting for a page to load, you should be passing a timeout value
> to open:
>
> open: function( path, callback, timeout )
>
> What is your test waiting on?
>
> - Brian
>
> brian.mosc...@gmail.com

Brian Moschel

unread,
Oct 1, 2010, 9:37:04 AM10/1/10
to func...@googlegroups.com
Ah, yes this should be possible and not difficult at all.  I will work on it this weekend.

- Brian

John Tregoning

unread,
Oct 1, 2010, 9:39:29 AM10/1/10
to FuncUnit
FTW! Great stuff, thanks!
> \Development\Training\Support847-727-1609begin_of_the_skype_highlighting              847-727-1609      end_of_the_skype_highlighting
> brian.mosc...@gmail.com

John Tregoning

unread,
Oct 22, 2010, 9:57:49 AM10/22/10
to FuncUnit
Hello guys, has anybody had time to look at this?. I would normally
just fix it myself but I must admit that I am finding it really
difficult to follow the code.

Brian Moschel

unread,
Oct 25, 2010, 3:07:17 AM10/25/10
to func...@googlegroups.com
Not yet, sorry John.  I'll try to get to this in the next day or two.  Thanks for the reminder.

- Brian
--
Brian Moschel

Jupiter Consulting
\Development\Training\Support
847-727-1609

John Tregoning

unread,
Oct 30, 2010, 6:14:04 PM10/30/10
to FuncUnit
Great, thanks looking forward to it.

On Oct 25, 8:07 am, Brian Moschel <brian.mosc...@gmail.com> wrote:
> Not yet, sorry John.  I'll try to get to this in the next day or two.
>  Thanks for the reminder.
>
> - Brian
>
> On Fri, Oct 22, 2010 at 8:57 AM, John Tregoning <tregon...@gmail.com> wrote:
> > Hello guys, has anybody had time to look at this?. I would normally
> > just fix it myself but I must admit that I am finding it really
> > difficult to follow the code.
>
> --
> Brian Moschel
>
> Jupiter Consulting
> \Development\Training\Support
> 847-727-1609
> brian.mosc...@gmail.com
Reply all
Reply to author
Forward
0 new messages