Cusotm JS read routing params

Hi everyone,
I have a completely blank page with a routing rule like this page/:room/:token
I have to read these parameters from a javascript function which must be launched when the page is loaded.

Can you give me some suggestions?