puppeteer-ruby 0.0.13 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +2 -14
  3. data/.github/workflows/docs.yml +45 -0
  4. data/.github/workflows/reviewdog.yml +15 -0
  5. data/.rubocop.yml +39 -3
  6. data/README.md +54 -1
  7. data/lib/puppeteer.rb +10 -2
  8. data/lib/puppeteer/browser.rb +53 -34
  9. data/lib/puppeteer/browser_context.rb +35 -5
  10. data/lib/puppeteer/cdp_session.rb +3 -19
  11. data/lib/puppeteer/concurrent_ruby_utils.rb +6 -0
  12. data/lib/puppeteer/connection.rb +9 -16
  13. data/lib/puppeteer/debug_print.rb +1 -1
  14. data/lib/puppeteer/define_async_method.rb +23 -0
  15. data/lib/puppeteer/dom_world.rb +84 -73
  16. data/lib/puppeteer/element_handle.rb +46 -63
  17. data/lib/puppeteer/emulation_manager.rb +2 -6
  18. data/lib/puppeteer/env.rb +18 -0
  19. data/lib/puppeteer/execution_context.rb +1 -6
  20. data/lib/puppeteer/frame.rb +46 -46
  21. data/lib/puppeteer/frame_manager.rb +7 -25
  22. data/lib/puppeteer/js_handle.rb +39 -38
  23. data/lib/puppeteer/keyboard.rb +9 -29
  24. data/lib/puppeteer/mouse.rb +20 -24
  25. data/lib/puppeteer/network_manager.rb +163 -5
  26. data/lib/puppeteer/page.rb +221 -181
  27. data/lib/puppeteer/page/pdf_options.rb +166 -0
  28. data/lib/puppeteer/remote_object.rb +18 -5
  29. data/lib/puppeteer/request.rb +330 -0
  30. data/lib/puppeteer/response.rb +113 -0
  31. data/lib/puppeteer/touch_screen.rb +2 -7
  32. data/lib/puppeteer/version.rb +1 -1
  33. data/lib/puppeteer/wait_task.rb +3 -5
  34. data/lib/puppeteer/web_socket.rb +7 -0
  35. data/puppeteer-ruby.gemspec +2 -1
  36. metadata +25 -103
  37. data/docs/Puppeteer.html +0 -2338
  38. data/docs/Puppeteer/AsyncAwaitBehavior.html +0 -105
  39. data/docs/Puppeteer/Browser.html +0 -2258
  40. data/docs/Puppeteer/BrowserContext.html +0 -809
  41. data/docs/Puppeteer/BrowserFetcher.html +0 -214
  42. data/docs/Puppeteer/BrowserRunner.html +0 -914
  43. data/docs/Puppeteer/BrowserRunner/BrowserProcess.html +0 -477
  44. data/docs/Puppeteer/CDPSession.html +0 -813
  45. data/docs/Puppeteer/CDPSession/Error.html +0 -124
  46. data/docs/Puppeteer/ConcurrentRubyUtils.html +0 -438
  47. data/docs/Puppeteer/Connection.html +0 -964
  48. data/docs/Puppeteer/Connection/MessageCallback.html +0 -434
  49. data/docs/Puppeteer/Connection/ProtocolError.html +0 -216
  50. data/docs/Puppeteer/Connection/RequestDebugPrinter.html +0 -217
  51. data/docs/Puppeteer/Connection/ResponseDebugPrinter.html +0 -244
  52. data/docs/Puppeteer/ConsoleMessage.html +0 -565
  53. data/docs/Puppeteer/ConsoleMessage/Location.html +0 -433
  54. data/docs/Puppeteer/DOMWorld.html +0 -2293
  55. data/docs/Puppeteer/DOMWorld/DetachedError.html +0 -124
  56. data/docs/Puppeteer/DOMWorld/DocumentEvaluationError.html +0 -124
  57. data/docs/Puppeteer/DebugPrint.html +0 -233
  58. data/docs/Puppeteer/Device.html +0 -470
  59. data/docs/Puppeteer/Devices.html +0 -139
  60. data/docs/Puppeteer/ElementHandle.html +0 -2542
  61. data/docs/Puppeteer/ElementHandle/BoundingBox.html +0 -507
  62. data/docs/Puppeteer/ElementHandle/BoxModel.html +0 -404
  63. data/docs/Puppeteer/ElementHandle/ElementNotFoundError.html +0 -206
  64. data/docs/Puppeteer/ElementHandle/ElementNotVisibleError.html +0 -206
  65. data/docs/Puppeteer/ElementHandle/Point.html +0 -492
  66. data/docs/Puppeteer/ElementHandle/ScrollIntoViewError.html +0 -124
  67. data/docs/Puppeteer/EmulationManager.html +0 -454
  68. data/docs/Puppeteer/EventCallbackable.html +0 -499
  69. data/docs/Puppeteer/EventCallbackable/EventListeners.html +0 -435
  70. data/docs/Puppeteer/ExecutionContext.html +0 -998
  71. data/docs/Puppeteer/ExecutionContext/EvaluationError.html +0 -124
  72. data/docs/Puppeteer/ExecutionContext/JavaScriptExpression.html +0 -357
  73. data/docs/Puppeteer/ExecutionContext/JavaScriptFunction.html +0 -389
  74. data/docs/Puppeteer/FileChooser.html +0 -455
  75. data/docs/Puppeteer/Frame.html +0 -3835
  76. data/docs/Puppeteer/FrameManager.html +0 -2410
  77. data/docs/Puppeteer/FrameManager/NavigationError.html +0 -124
  78. data/docs/Puppeteer/IfPresent.html +0 -222
  79. data/docs/Puppeteer/JSHandle.html +0 -1352
  80. data/docs/Puppeteer/Keyboard.html +0 -1557
  81. data/docs/Puppeteer/Keyboard/KeyDefinition.html +0 -831
  82. data/docs/Puppeteer/Keyboard/KeyDescription.html +0 -603
  83. data/docs/Puppeteer/Launcher.html +0 -237
  84. data/docs/Puppeteer/Launcher/Base.html +0 -385
  85. data/docs/Puppeteer/Launcher/Base/ExecutablePathNotFound.html +0 -124
  86. data/docs/Puppeteer/Launcher/BrowserOptions.html +0 -441
  87. data/docs/Puppeteer/Launcher/Chrome.html +0 -674
  88. data/docs/Puppeteer/Launcher/Chrome/DefaultArgs.html +0 -382
  89. data/docs/Puppeteer/Launcher/ChromeArgOptions.html +0 -531
  90. data/docs/Puppeteer/Launcher/LaunchOptions.html +0 -893
  91. data/docs/Puppeteer/LifecycleWatcher.html +0 -834
  92. data/docs/Puppeteer/LifecycleWatcher/ExpectedLifecycle.html +0 -363
  93. data/docs/Puppeteer/LifecycleWatcher/FrameDetachedError.html +0 -206
  94. data/docs/Puppeteer/LifecycleWatcher/TerminatedError.html +0 -124
  95. data/docs/Puppeteer/Mouse.html +0 -1095
  96. data/docs/Puppeteer/Mouse/Button.html +0 -136
  97. data/docs/Puppeteer/NetworkManager.html +0 -901
  98. data/docs/Puppeteer/NetworkManager/Credentials.html +0 -385
  99. data/docs/Puppeteer/Page.html +0 -6173
  100. data/docs/Puppeteer/Page/FileChooserTimeoutError.html +0 -206
  101. data/docs/Puppeteer/Page/ScreenshotOptions.html +0 -845
  102. data/docs/Puppeteer/Page/ScriptTag.html +0 -555
  103. data/docs/Puppeteer/Page/StyleTag.html +0 -448
  104. data/docs/Puppeteer/Page/TargetCrashedError.html +0 -124
  105. data/docs/Puppeteer/RemoteObject.html +0 -1087
  106. data/docs/Puppeteer/Target.html +0 -1336
  107. data/docs/Puppeteer/Target/InitializeFailure.html +0 -124
  108. data/docs/Puppeteer/Target/TargetInfo.html +0 -729
  109. data/docs/Puppeteer/TimeoutError.html +0 -135
  110. data/docs/Puppeteer/TimeoutSettings.html +0 -496
  111. data/docs/Puppeteer/TouchScreen.html +0 -464
  112. data/docs/Puppeteer/Viewport.html +0 -837
  113. data/docs/Puppeteer/WaitTask.html +0 -637
  114. data/docs/Puppeteer/WaitTask/TerminatedError.html +0 -124
  115. data/docs/Puppeteer/WaitTask/TimeoutError.html +0 -206
  116. data/docs/Puppeteer/WebSocket.html +0 -673
  117. data/docs/Puppeteer/WebSocket/DriverImpl.html +0 -412
  118. data/docs/Puppeteer/WebSocket/TransportError.html +0 -124
  119. data/docs/Puppeteer/WebSocketTransport.html +0 -600
  120. data/docs/Puppeteer/WebSocktTransportError.html +0 -124
  121. data/docs/_index.html +0 -816
  122. data/docs/class_list.html +0 -51
  123. data/docs/css/common.css +0 -1
  124. data/docs/css/full_list.css +0 -58
  125. data/docs/css/style.css +0 -496
  126. data/docs/file.README.html +0 -125
  127. data/docs/file_list.html +0 -56
  128. data/docs/frames.html +0 -17
  129. data/docs/index.html +0 -125
  130. data/docs/js/app.js +0 -314
  131. data/docs/js/full_list.js +0 -216
  132. data/docs/js/jquery.js +0 -4
  133. data/docs/method_list.html +0 -4123
  134. data/docs/top-level-namespace.html +0 -126
  135. data/lib/puppeteer/async_await_behavior.rb +0 -38
@@ -1,499 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Module: Puppeteer::EventCallbackable
8
-
9
- &mdash; Documentation by YARD 0.9.24
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
-
17
- <script type="text/javascript">
18
- pathId = "Puppeteer::EventCallbackable";
19
- relpath = '../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../_index.html">Index (E)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../Puppeteer.html" title="Puppeteer (class)">Puppeteer</a></span></span>
41
- &raquo;
42
- <span class="title">EventCallbackable</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Module: Puppeteer::EventCallbackable
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
- <dl>
78
- <dt>Included in:</dt>
79
- <dd><span class='object_link'><a href="Browser.html" title="Puppeteer::Browser (class)">Browser</a></span>, <span class='object_link'><a href="BrowserContext.html" title="Puppeteer::BrowserContext (class)">BrowserContext</a></span>, <span class='object_link'><a href="CDPSession.html" title="Puppeteer::CDPSession (class)">CDPSession</a></span>, <span class='object_link'><a href="Connection.html" title="Puppeteer::Connection (class)">Connection</a></span>, <span class='object_link'><a href="FrameManager.html" title="Puppeteer::FrameManager (class)">FrameManager</a></span>, <span class='object_link'><a href="NetworkManager.html" title="Puppeteer::NetworkManager (class)">NetworkManager</a></span>, <span class='object_link'><a href="Page.html" title="Puppeteer::Page (class)">Page</a></span></dd>
80
- </dl>
81
-
82
-
83
-
84
- <dl>
85
- <dt>Defined in:</dt>
86
- <dd>lib/puppeteer/event_callbackable.rb</dd>
87
- </dl>
88
-
89
- </div>
90
-
91
- <h2>Defined Under Namespace</h2>
92
- <p class="children">
93
-
94
-
95
-
96
-
97
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="EventCallbackable/EventListeners.html" title="Puppeteer::EventCallbackable::EventListeners (class)">EventListeners</a></span>
98
-
99
-
100
- </p>
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
- <h2>
110
- Instance Method Summary
111
- <small><a href="#" class="summary_toggle">collapse</a></small>
112
- </h2>
113
-
114
- <ul class="summary">
115
-
116
- <li class="public ">
117
- <span class="summary_signature">
118
-
119
- <a href="#add_event_listener-instance_method" title="#add_event_listener (instance method)">#<strong>add_event_listener</strong>(event_name, &amp;block) &#x21d2; Object </a>
120
-
121
-
122
-
123
- </span>
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
- <span class="summary_desc"><div class='inline'></div></span>
134
-
135
- </li>
136
-
137
-
138
- <li class="public ">
139
- <span class="summary_signature">
140
-
141
- <a href="#emit_event-instance_method" title="#emit_event (instance method)">#<strong>emit_event</strong>(event_name, *args, **kwargs) &#x21d2; Object </a>
142
-
143
-
144
-
145
- </span>
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
- <span class="summary_desc"><div class='inline'></div></span>
156
-
157
- </li>
158
-
159
-
160
- <li class="public ">
161
- <span class="summary_signature">
162
-
163
- <a href="#observe_first-instance_method" title="#observe_first (instance method)">#<strong>observe_first</strong>(event_name, &amp;block) &#x21d2; Object </a>
164
-
165
-
166
-
167
- </span>
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
- <span class="summary_desc"><div class='inline'></div></span>
178
-
179
- </li>
180
-
181
-
182
- <li class="public ">
183
- <span class="summary_signature">
184
-
185
- <a href="#on_event-instance_method" title="#on_event (instance method)">#<strong>on_event</strong>(event_name, &amp;block) &#x21d2; Object </a>
186
-
187
-
188
-
189
- </span>
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
- <span class="summary_desc"><div class='inline'></div></span>
200
-
201
- </li>
202
-
203
-
204
- <li class="public ">
205
- <span class="summary_signature">
206
-
207
- <a href="#remove_event_listener-instance_method" title="#remove_event_listener (instance method)">#<strong>remove_event_listener</strong>(*id_args) &#x21d2; Object </a>
208
-
209
-
210
-
211
- </span>
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
- <span class="summary_desc"><div class='inline'></div></span>
222
-
223
- </li>
224
-
225
-
226
- </ul>
227
-
228
-
229
-
230
-
231
- <div id="instance_method_details" class="method_details_list">
232
- <h2>Instance Method Details</h2>
233
-
234
-
235
- <div class="method_details first">
236
- <h3 class="signature first" id="add_event_listener-instance_method">
237
-
238
- #<strong>add_event_listener</strong>(event_name, &amp;block) &#x21d2; <tt>Object</tt>
239
-
240
-
241
-
242
-
243
-
244
- </h3><table class="source_code">
245
- <tr>
246
- <td>
247
- <pre class="lines">
248
-
249
-
250
- 29
251
- 30
252
- 31
253
- 32</pre>
254
- </td>
255
- <td>
256
- <pre class="code"><span class="info file"># File 'lib/puppeteer/event_callbackable.rb', line 29</span>
257
-
258
- <span class='kw'>def</span> <span class='id identifier rubyid_add_event_listener'>add_event_listener</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
259
- <span class='ivar'>@event_listeners</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
260
- <span class='lparen'>(</span><span class='ivar'>@event_listeners</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="EventCallbackable/EventListeners.html" title="Puppeteer::EventCallbackable::EventListeners (class)">EventListeners</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="EventCallbackable/EventListeners.html#initialize-instance_method" title="Puppeteer::EventCallbackable::EventListeners#initialize (method)">new</a></span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
261
- <span class='kw'>end</span></pre>
262
- </td>
263
- </tr>
264
- </table>
265
- </div>
266
-
267
- <div class="method_details ">
268
- <h3 class="signature " id="emit_event-instance_method">
269
-
270
- #<strong>emit_event</strong>(event_name, *args, **kwargs) &#x21d2; <tt>Object</tt>
271
-
272
-
273
-
274
-
275
-
276
- </h3><table class="source_code">
277
- <tr>
278
- <td>
279
- <pre class="lines">
280
-
281
-
282
- 58
283
- 59
284
- 60
285
- 61
286
- 62
287
- 63
288
- 64
289
- 65
290
- 66
291
- 67
292
- 68
293
- 69
294
- 70
295
- 71
296
- 72
297
- 73
298
- 74
299
- 75
300
- 76
301
- 77
302
- 78
303
- 79
304
- 80
305
- 81
306
- 82
307
- 83
308
- 84
309
- 85
310
- 86
311
- 87
312
- 88
313
- 89
314
- 90
315
- 91
316
- 92
317
- 93
318
- 94
319
- 95
320
- 96
321
- 97
322
- 98</pre>
323
- </td>
324
- <td>
325
- <pre class="code"><span class="info file"># File 'lib/puppeteer/event_callbackable.rb', line 58</span>
326
-
327
- <span class='kw'>def</span> <span class='id identifier rubyid_emit_event'>emit_event</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
328
- <span class='ivar'>@event_callbackable_handlers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
329
- <span class='ivar'>@event_listeners</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
330
-
331
- <span class='kw'>if</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
332
- <span class='comment'># In Ruby&#39;s specification (version &lt; 2.7),
333
- </span> <span class='comment'># `method(:x).call(*args, **kwargs)` is equivalent to `x(*args, {})`
334
- </span> <span class='comment'># It often causes unexpected ArgumentError.
335
- </span> <span class='comment'>#
336
- </span> <span class='comment'># ----------------
337
- </span> <span class='comment'># def greet
338
- </span> <span class='comment'># puts &#39;Hello!&#39;
339
- </span> <span class='comment'># end
340
- </span> <span class='comment'>#
341
- </span> <span class='comment'># def call_me(*args, **kwargs)
342
- </span> <span class='comment'># greet(*args, **kwargs) # =&gt; &#39;Hello!&#39;
343
- </span> <span class='comment'>#
344
- </span> <span class='comment'># method(:greet).call(*args, **kwargs) # =&gt; `greet&#39;: wrong number of arguments (given 1, expected 0) (ArgumentError)
345
- </span> <span class='comment'># end
346
- </span> <span class='comment'>#
347
- </span> <span class='comment'># call_me
348
- </span> <span class='comment'># ----------------
349
- </span> <span class='comment'>#
350
- </span> <span class='comment'># This behavior is really annoying, and should be avoided, because we often want to set event handler as below:
351
- </span> <span class='comment'>#
352
- </span> <span class='comment'># `on_event &#39;Some.Event.awesome&#39;, &amp;method(:handle_awesome_event)`
353
- </span> <span class='comment'>#
354
- </span> <span class='comment'># So Let&#39;s avoid it by checking kwargs.
355
- </span> <span class='ivar'>@event_callbackable_handlers</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
356
- <span class='ivar'>@event_listeners</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_proc'>proc</span><span class='op'>|</span>
357
- <span class='id identifier rubyid_proc'>proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
358
- <span class='kw'>end</span>
359
- <span class='kw'>else</span>
360
- <span class='ivar'>@event_callbackable_handlers</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
361
- <span class='ivar'>@event_listeners</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_proc'>proc</span><span class='op'>|</span>
362
- <span class='id identifier rubyid_proc'>proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
363
- <span class='kw'>end</span>
364
- <span class='kw'>end</span>
365
-
366
- <span class='id identifier rubyid_event_name'>event_name</span>
367
- <span class='kw'>end</span></pre>
368
- </td>
369
- </tr>
370
- </table>
371
- </div>
372
-
373
- <div class="method_details ">
374
- <h3 class="signature " id="observe_first-instance_method">
375
-
376
- #<strong>observe_first</strong>(event_name, &amp;block) &#x21d2; <tt>Object</tt>
377
-
378
-
379
-
380
-
381
-
382
- </h3><table class="source_code">
383
- <tr>
384
- <td>
385
- <pre class="lines">
386
-
387
-
388
- 42
389
- 43
390
- 44
391
- 45
392
- 46
393
- 47
394
- 48
395
- 49
396
- 50
397
- 51</pre>
398
- </td>
399
- <td>
400
- <pre class="code"><span class="info file"># File 'lib/puppeteer/event_callbackable.rb', line 42</span>
401
-
402
- <span class='kw'>def</span> <span class='id identifier rubyid_observe_first'>observe_first</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
403
- <span class='id identifier rubyid_listener_id'>listener_id</span> <span class='op'>=</span> <span class='id identifier rubyid_add_event_listener'>add_event_listener</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='op'>|</span>
404
- <span class='kw'>if</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
405
- <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
406
- <span class='kw'>else</span>
407
- <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
408
- <span class='kw'>end</span>
409
- <span class='id identifier rubyid_remove_event_listener'>remove_event_listener</span><span class='lparen'>(</span><span class='id identifier rubyid_listener_id'>listener_id</span><span class='rparen'>)</span>
410
- <span class='kw'>end</span>
411
- <span class='kw'>end</span></pre>
412
- </td>
413
- </tr>
414
- </table>
415
- </div>
416
-
417
- <div class="method_details ">
418
- <h3 class="signature " id="on_event-instance_method">
419
-
420
- #<strong>on_event</strong>(event_name, &amp;block) &#x21d2; <tt>Object</tt>
421
-
422
-
423
-
424
-
425
-
426
- </h3><table class="source_code">
427
- <tr>
428
- <td>
429
- <pre class="lines">
430
-
431
-
432
- 53
433
- 54
434
- 55
435
- 56</pre>
436
- </td>
437
- <td>
438
- <pre class="code"><span class="info file"># File 'lib/puppeteer/event_callbackable.rb', line 53</span>
439
-
440
- <span class='kw'>def</span> <span class='id identifier rubyid_on_event'>on_event</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
441
- <span class='ivar'>@event_callbackable_handlers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
442
- <span class='ivar'>@event_callbackable_handlers</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
443
- <span class='kw'>end</span></pre>
444
- </td>
445
- </tr>
446
- </table>
447
- </div>
448
-
449
- <div class="method_details ">
450
- <h3 class="signature " id="remove_event_listener-instance_method">
451
-
452
- #<strong>remove_event_listener</strong>(*id_args) &#x21d2; <tt>Object</tt>
453
-
454
-
455
-
456
-
457
-
458
- </h3><table class="source_code">
459
- <tr>
460
- <td>
461
- <pre class="lines">
462
-
463
-
464
- 34
465
- 35
466
- 36
467
- 37
468
- 38
469
- 39
470
- 40</pre>
471
- </td>
472
- <td>
473
- <pre class="code"><span class="info file"># File 'lib/puppeteer/event_callbackable.rb', line 34</span>
474
-
475
- <span class='kw'>def</span> <span class='id identifier rubyid_remove_event_listener'>remove_event_listener</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_id_args'>id_args</span><span class='rparen'>)</span>
476
- <span class='lparen'>(</span><span class='ivar'>@event_listeners</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_listeners'>listeners</span><span class='op'>|</span>
477
- <span class='id identifier rubyid_id_args'>id_args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_id'>id</span><span class='op'>|</span>
478
- <span class='id identifier rubyid_listeners'>listeners</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
479
- <span class='kw'>end</span>
480
- <span class='kw'>end</span>
481
- <span class='kw'>end</span></pre>
482
- </td>
483
- </tr>
484
- </table>
485
- </div>
486
-
487
- </div>
488
-
489
- </div>
490
-
491
- <div id="footer">
492
- Generated on Wed Jun 24 03:07:58 2020 by
493
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
494
- 0.9.24 (ruby-2.6.3).
495
- </div>
496
-
497
- </div>
498
- </body>
499
- </html>