This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Description
At the moment any variables have to be explicitly passed during tab.run() and tab.wait(). However very often we would like to reuse the same value between multiple invocations of these methods.
We could do something simple as:
tabs.define({ // perhaps also tab.define()
username: 'foo',
password: 'bla',
findAuthFields: async () => wait.selectorAll('input#username, input#password').amount(2),
})
await tab.run(async () => {
await wait.documentComplete()
const [usernameField, passwordField] = await findAuthFields()
await interact.type(usernameField, [...username])
await interact.type(passwordField, [...password])
})
If we restrict this so that:
define() only affects new invocations and not pending invocations
- content scripts can not
define()
- serialization will occur immediately when
define() is called
The implementation should be very simple, and the resulting API and its side-effects will be easy to understand for scripters.