Waiting for Safari "Tabs" (plural) to load

I’ve found this text on the BBS:

repeat
if (do JavaScript "document.readyState" in document 1) = "complete" then
exit repeat
else
delay 1
end if
end repeat
end tell

How can modify this to wait for a group of tabs to load?