Adrià Vilanova MartÃnez | 4677317 | 2024-01-10 21:44:22 +0100 | [diff] [blame] | 1 | import {getOptions} from '../common/optionsUtils.js'; |
| 2 | |
| 3 | export async function setUpRedirectIfEnabled(options = null) { |
| 4 | if (options === null) options = await getOptions(['redirect']); |
| 5 | |
| 6 | if (options.redirect) { |
| 7 | setUpRedirect(); |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | function setUpRedirect() { |
| 12 | window.TWPTRedirectHash = window.location.hash; |
| 13 | // We're preloading the redirect option so we can redirect faster in |
| 14 | // publicThread.js without having to retrieve the options again. |
| 15 | window.TWPTShouldRedirect = true; |
| 16 | } |