puppeteer-bidi 0.0.1.beta4 → 0.0.1.beta6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d3afdcd6aeda92482fb530cab98075505ae8e6d9b76da6a8f65dc01d3f76ee6
4
- data.tar.gz: 2c74ca2d812a27ad8051911cb213d008a6d4077781ca5ecf0b782a2a0f62d72e
3
+ metadata.gz: 4520bc0ace52d1165fefd304276d8c819f258802d4412e3b9a6432c235d10b0f
4
+ data.tar.gz: 1cb2d54fe0546bc416e1f087d919593df5c5ae6d2588503b3ab6cd7fd5e855a5
5
5
  SHA512:
6
- metadata.gz: 0e900fd975d92973786eea9546f22f8b71afb2a856575c6ef15bba023285322abe888887c1b92458fa736d887cfff8192c0951738d75c91445d69cda46944740
7
- data.tar.gz: 070afa10326ae5a789b70b40a55c5b5462dbb5599fc5b8e30b83cf8522752fe65d1c7959cc0e42d937d244a2e0fc23c050f0a48b89eb99f0c8fa5223bb924129
6
+ metadata.gz: 701df308c01563615b819482b6c0fceb35a236ec310ebb185bd0e2e479f06243c975f3bdca4cd597cd0e35e0d9eec90f1baa9678fadfdf7613c18eeb015dff8e
7
+ data.tar.gz: e15369956edb093601f3d9f79303986b2e4534c5d4ffec6b2f96cda81d395f5d283c1f903ba760d875e1fc2992761d100fc35c2adc2ff59487c9ef167d1c0354
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Puppeteer
4
4
  module Bidi
5
- VERSION = "0.0.1.beta4"
5
+ VERSION = "0.0.1.beta6"
6
6
  end
7
7
  end
@@ -38,15 +38,33 @@ module Puppeteer
38
38
  # @rbs headless: bool -- Run browser in headless mode
39
39
  # @rbs args: Array[String]? -- Additional browser arguments
40
40
  # @rbs timeout: Numeric? -- Launch timeout in seconds
41
- # @rbs return: Browser -- Browser instance
42
- def self.launch(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil)
43
- Browser.launch(
44
- executable_path: executable_path,
45
- user_data_dir: user_data_dir,
46
- headless: headless,
47
- args: args,
48
- timeout: timeout
49
- )
41
+ # @rbs &block: (Browser -> void)? -- Optional block to execute with the browser instance
42
+ # @rbs return: Browser? -- Browser instance (if no block given)
43
+ def self.launch(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil, &block)
44
+ if block
45
+ Sync do
46
+ begin
47
+ browser = Browser.launch(
48
+ executable_path: executable_path,
49
+ user_data_dir: user_data_dir,
50
+ headless: headless,
51
+ args: args,
52
+ timeout: timeout
53
+ )
54
+ block.call(browser)
55
+ ensure
56
+ browser&.close
57
+ end
58
+ end
59
+ else
60
+ Browser.launch(
61
+ executable_path: executable_path,
62
+ user_data_dir: user_data_dir,
63
+ headless: headless,
64
+ args: args,
65
+ timeout: timeout
66
+ )
67
+ end
50
68
  end
51
69
 
52
70
  # Connect to an existing browser instance
@@ -8,8 +8,9 @@ module Puppeteer
8
8
  # @rbs headless: bool -- Run browser in headless mode
9
9
  # @rbs args: Array[String]? -- Additional browser arguments
10
10
  # @rbs timeout: Numeric? -- Launch timeout in seconds
11
- # @rbs return: Browser -- Browser instance
12
- def self.launch: (?executable_path: String?, ?user_data_dir: String?, ?headless: bool, ?args: Array[String]?, ?timeout: Numeric?) -> Browser
11
+ # @rbs &block: (Browser -> void)? -- Optional block to execute with the browser instance
12
+ # @rbs return: Browser? -- Browser instance (if no block given)
13
+ def self.launch: (?executable_path: String?, ?user_data_dir: String?, ?headless: bool, ?args: Array[String]?, ?timeout: Numeric?) ?{ (?) -> untyped } -> Browser?
13
14
 
14
15
  # Connect to an existing browser instance
15
16
  # @rbs ws_endpoint: String -- WebSocket endpoint URL
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppeteer-bidi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta4
4
+ version: 0.0.1.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki