Skip to content

Commit

Permalink
Add pauseIf() / pauseUnless() (#999)
Browse files Browse the repository at this point in the history
* Add `pauseIf()`

* Add `pauseUnless()`
  • Loading branch information
u01jmg3 authored Sep 27, 2022
1 parent 5969741 commit 9e7e644
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,38 @@ public function pause($milliseconds)
return $this;
}

/**
* Pause for the given amount of milliseconds if the given condition is true.
*
* @param bool $boolean
* @param int $milliseconds
* @return $this
*/
public function pauseIf($boolean, $milliseconds)
{
if ($boolean) {
return $this->pause($milliseconds);
}

return $this;
}

/**
* Pause for the given amount of milliseconds unless the given condition is true.
*
* @param bool $boolean
* @param int $milliseconds
* @return $this
*/
public function pauseUnless($boolean, $milliseconds)
{
if (! $boolean) {
return $this->pause($milliseconds);
}

return $this;
}

/**
* Close the browser.
*
Expand Down

0 comments on commit 9e7e644

Please sign in to comment.