annotate vendor/jcalderonzumba/gastonjs/src/Browser/BrowserWindowTrait.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Zumba\GastonJS\Browser;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Class BrowserWindowTrait
Chris@0 7 * @package Zumba\GastonJS\Browser
Chris@0 8 */
Chris@0 9 trait BrowserWindowTrait {
Chris@0 10 /**
Chris@0 11 * Returns the current window handle name in the browser
Chris@0 12 * @param string $name
Chris@0 13 * @return mixed
Chris@0 14 */
Chris@0 15 public function windowHandle($name = null) {
Chris@0 16 return $this->command('window_handle', $name);
Chris@0 17 }
Chris@0 18
Chris@0 19 /**
Chris@0 20 * Returns all the window handles present in the browser
Chris@0 21 * @return array
Chris@0 22 */
Chris@0 23 public function windowHandles() {
Chris@0 24 return $this->command('window_handles');
Chris@0 25 }
Chris@0 26
Chris@0 27 /**
Chris@0 28 * Change the browser focus to another window
Chris@0 29 * @param $windowHandleName
Chris@0 30 * @return mixed
Chris@0 31 */
Chris@0 32 public function switchToWindow($windowHandleName) {
Chris@0 33 return $this->command('switch_to_window', $windowHandleName);
Chris@0 34 }
Chris@0 35
Chris@0 36 /**
Chris@0 37 * Opens a new window on the browser
Chris@0 38 * @return mixed
Chris@0 39 */
Chris@0 40 public function openNewWindow() {
Chris@0 41 return $this->command('open_new_window');
Chris@0 42 }
Chris@0 43
Chris@0 44 /**
Chris@0 45 * Closes a window on the browser by a given handler name
Chris@0 46 * @param $windowHandleName
Chris@0 47 * @return mixed
Chris@0 48 */
Chris@0 49 public function closeWindow($windowHandleName) {
Chris@0 50 return $this->command('close_window', $windowHandleName);
Chris@0 51 }
Chris@0 52
Chris@0 53 /**
Chris@0 54 * Gets the current request window name
Chris@0 55 * @return string
Chris@0 56 * @throws \Zumba\GastonJS\Exception\BrowserError
Chris@0 57 * @throws \Exception
Chris@0 58 */
Chris@0 59 public function windowName() {
Chris@0 60 return $this->command('window_name');
Chris@0 61 }
Chris@0 62
Chris@0 63 /**
Chris@0 64 * Zoom factor for a web page
Chris@0 65 * @param $zoomFactor
Chris@0 66 * @return mixed
Chris@0 67 */
Chris@0 68 public function setZoomFactor($zoomFactor) {
Chris@0 69 return $this->command('set_zoom_factor', $zoomFactor);
Chris@0 70 }
Chris@0 71
Chris@0 72 /**
Chris@0 73 * Gets the window size
Chris@0 74 * @param $windowHandleName
Chris@0 75 * @return mixed
Chris@0 76 */
Chris@0 77 public function windowSize($windowHandleName) {
Chris@0 78 return $this->command('window_size', $windowHandleName);
Chris@0 79 }
Chris@0 80
Chris@0 81 }