Tell WP register script to load a script only when the entire page is loaded

wp_register_script() is for telling WordPress about script files, and is a PHP function. It has no control over how the script executes, only where the <script></script> tag is output and what the URL is.

If you don’t want the script to execute until the page is loaded you need to put that JavaScript you posted in the relevant script file.