* Inserts a pause action for the specified devices, ensuring each device is * idle for a tick. The length of the pause (in milliseconds) may be specified * as the first parameter to this method (defaults to 0). Otherwise, you may * just specify the individual devices that should pause. *
(duration, ...devices)
| 744 | * @return {!Actions} a self reference. |
| 745 | */ |
| 746 | pause(duration, ...devices) { |
| 747 | if (duration instanceof Device) { |
| 748 | devices.push(duration) |
| 749 | duration = 0 |
| 750 | } else if (!duration) { |
| 751 | duration = 0 |
| 752 | } |
| 753 | |
| 754 | const action = { type: Action.Type.PAUSE, duration } |
| 755 | |
| 756 | // NB: need a properly typed variable for type checking. |
| 757 | /** @type {!Iterable<!Device>} */ |
| 758 | const iterable = devices.length === 0 ? this.sequences_.keys() : devices |
| 759 | for (const device of iterable) { |
| 760 | this.sequence_(device).push(action) |
| 761 | } |
| 762 | return this.sync_ ? this.synchronize() : this |
| 763 | } |
| 764 | |
| 765 | /** |
| 766 | * Inserts an action to press a single key. |
no test coverage detected