You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The module exports a single function, type, which takes a target element as its first argument, and any number of additional arguments as the steps to perform. Additional arguments perform actions based on their type:
Type
Action
string
Type text
number
Pause (milliseconds)
function
Call with target element
Promise
Wait for resolution
Usage
The most basic usage of type is providing a target element and a string to type.
In order to pause typing at any point, pass a number of milliseconds to pause.
type(element,'Hello',1000,'Hello world!');
Looping
In order to loop, pass type as a parameter to itself at the point at which you'd like to start looping. It can be helpful to alias type as loop to be explicit.
To loop a finite amount, pass your steps multiple times.
type(element, ...steps, ...steps, ...steps);
Waiting
When passed a Promise, type will wait for it to resolve before continuing. Because type itself returns a Promise, that means you can wait on a set of steps to complete before starting another.
constinit=type(target,'In a moment...',500);type(target,init,'start',500,'looping',loop);
Functions
Function arguments are passed the target element, and can be useful for operating on the target element between steps. If you return a Promise, type will wait for it to resolve.