pedz
unread,Jun 12, 2010, 12:40:00 PM6/12/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jspec
I think this pattern is going to grow over time given that the browser
GUI is single threaded. More and more I am going to a pattern where I
fire a start action and then wait for a completion event. In today's
example, I'm firing a request to a web worker which return a result
asynchronously via one of a few handlers -- onComplete, onError, etc.
I'm going to start trying to figure out a way to do this but what I
believe I want is something like:
it('should alert when worker is not found', function() {
loader = Loader({ worker_path: "bogus", onComplete:
onCompleteHandler });
loader.load_file("abcd");
wait_until([ onCompleteHandler, alert ], 6);
var z = get_alert_text();
z.length.should.eql(1);
});
Where wait_until waits for up to 6 seconds in this example or until
one of the two functions is called.
The array of handlers could be omitted and use the proxy facilities.
The array would just be a shorthand method.
If anyone has some suggestions that will help me with this, that would
be great to hear.
Thank you
Perry