MCPcopy
hub / github.com/liriliri/eruda / _bindEvent

Method _bindEvent

src/Network/Network.js:275–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273 }
274 }
275 _bindEvent() {
276 const $control = this._$control
277 const $filterText = this._$filterText
278 const requestDataGrid = this._requestDataGrid
279
280 const self = this
281
282 $control
283 .on('click', c('.clear-request'), () => this.clear())
284 .on('click', c('.show-detail'), this._showDetail)
285 .on('click', c('.copy-curl'), this._copyCurl)
286 .on('click', c('.record'), this._toggleRecording)
287 .on('click', c('.filter'), () => {
288 LunaModal.prompt('Filter').then((filter) => {
289 if (isNull(filter)) return
290
291 $filterText.text(filter)
292 requestDataGrid.setOption('filter', trim(filter))
293 })
294 })
295
296 requestDataGrid.on('select', (node) => {
297 const id = $(node.container).data('id')
298 const request = self._requests[id]
299 this._selectedRequest = request
300 this._updateButtons()
301 if (this._splitMode) {
302 this._showDetail()
303 }
304 })
305
306 requestDataGrid.on('deselect', () => {
307 this._selectedRequest = null
308 this._updateButtons()
309 this._detail.hide()
310 })
311
312 this._resizeSensor.addListener(
313 throttle(() => this._updateDataGridHeight(), 15)
314 )
315
316 this._splitMediaQuery.on('match', () => {
317 this._detail.hide()
318 this._splitMode = true
319 })
320 this._splitMediaQuery.on('unmatch', () => {
321 this._detail.hide()
322 this._splitMode = false
323 })
324 this._detail.on('hide', () => {
325 if (this._splitMode) {
326 this._$network.css('width', '100%')
327 }
328 })
329
330 chobitsu.domain('Network').enable()
331
332 const network = chobitsu.domain('Network')

Callers 1

initMethod · 0.95

Calls 6

clearMethod · 0.95
_updateButtonsMethod · 0.95
_updateDataGridHeightMethod · 0.95
onMethod · 0.80
textMethod · 0.65
hideMethod · 0.65

Tested by

no test coverage detected