andrewhao-chrome_remote 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/chrome_remote/client.rb +8 -6
- data/lib/chrome_remote/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b59d1acd253018419f7fccd029242d78f64489df9a3f40ac24202ef2d29e18ed
|
4
|
+
data.tar.gz: 1e87cfd0ac9470bda7f06db4f4a90bb5a6c19340893892b36aea1842d51a056c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a73161104a74ee85ec8aca043b1d9817c07961c497ed92544e210726b8767d773f56ed9f69a215245692c8c717e5818dfe8a57909aa74b3e369b94d9006b819
|
7
|
+
data.tar.gz: f4018cfc43ae09167769be742d272a2d16261d1426a2590361bf2b8088b1e172153346414102146ebd26f704361b936eeda6351b3c807dac1858964808b414af
|
data/.gitignore
CHANGED
data/lib/chrome_remote/client.rb
CHANGED
@@ -31,13 +31,15 @@ module ChromeRemote
|
|
31
31
|
read_until { false }
|
32
32
|
end
|
33
33
|
|
34
|
-
def wait_for(event_name=nil)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
def wait_for(event_name=nil, timeout: nil)
|
35
|
+
Timeout::timeout(timeout) do
|
36
|
+
if event_name
|
37
|
+
msg = read_until { |msg| msg["method"] == event_name }
|
38
|
+
elsif block_given?
|
39
|
+
msg = read_until { |msg| yield(msg["method"], msg["params"]) }
|
40
|
+
end
|
41
|
+
Hashie::Mash.new(msg["params"])
|
39
42
|
end
|
40
|
-
Hashie::Mash.new(msg["params"])
|
41
43
|
end
|
42
44
|
|
43
45
|
private
|