(syncedForm: SyncedForm | undefined)
| 86 | } |
| 87 | |
| 88 | export default async function initTokenValidation(syncedForm: SyncedForm | undefined): Promise<void> { |
| 89 | await validateToken(); |
| 90 | |
| 91 | // Listen to events |
| 92 | const field = $('input[name="personalToken"]'); |
| 93 | field.addEventListener('input', validateToken); |
| 94 | field.addEventListener('focus', () => { |
| 95 | field.type = 'text'; |
| 96 | }); |
| 97 | field.addEventListener('blur', () => { |
| 98 | field.type = 'password'; |
| 99 | }); |
| 100 | |
| 101 | // Update domain-dependent page content when the domain is changed |
| 102 | syncedForm?.onChange(async () => { |
| 103 | // TODO: Fix upstream bug https://github.com/fregante/webext-options-sync-per-domain/issues/10#issuecomment-3077459946 |
| 104 | await delay(100); |
| 105 | await validateToken(); |
| 106 | }); |
| 107 | } |
no test coverage detected