generated from renoki-co/laravel-package-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from renoki-co/feature/wait-for-selector
[feature] Wait for selector
- Loading branch information
Showing
11 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace RenokiCo\Clusteer\Actions; | ||
|
||
class WaitForSelector extends Wait | ||
{ | ||
/** | ||
* The selector to wait for. | ||
* | ||
* @var string | ||
*/ | ||
protected $selector; | ||
|
||
/** | ||
* Initialize the action. | ||
* | ||
* @param string $selector | ||
* @param int $seconds | ||
* @return void | ||
*/ | ||
public function __construct(string $selector, int $seconds) | ||
{ | ||
parent::__construct($seconds); | ||
|
||
$this->selector = $selector; | ||
} | ||
|
||
/** | ||
* Format to an array that can instruct and be read | ||
* by the JS script to perform a specific action. | ||
* | ||
* @return array | ||
*/ | ||
public function format(): array | ||
{ | ||
return [ | ||
'name' => 'wait-for-selector', | ||
'selector' => $this->selector, | ||
'seconds' => $this->seconds, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,12 @@ | |
> | ||
Click me with random mouse buttons | ||
</button> | ||
<button | ||
id="button-trigger-selector" | ||
@click.prevent="createWaitForTimeoutTrigger" | ||
> | ||
Click me to start a 5s timeout for the selector <kbd>id="selector"</kbd> to show | ||
</button> | ||
</div> | ||
|
||
<div> | ||
|
@@ -44,6 +50,9 @@ | |
<div> | ||
Cookies enabled: {{ cookiesEnabled() ? 'Yes' : 'No' }} | ||
</div> | ||
<div v-if="showSelector" id="selector"> | ||
Selector shown :) | ||
</div> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
|
@@ -56,6 +65,7 @@ | |
leftClicked: false, | ||
middleClicked: false, | ||
typedText: '', | ||
showSelector: false, | ||
}, | ||
created() { | ||
window.addEventListener('keydown', (e) => { | ||
|
@@ -79,6 +89,11 @@ | |
|
||
return cookieEnabled; | ||
}, | ||
createWaitForTimeoutTrigger() { | ||
setTimeout(() => { | ||
this.showSelector = true; | ||
}, 5000); | ||
} | ||
}, | ||
}); | ||
</script> |