Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Remove emitting of lifecycle events
Browse files Browse the repository at this point in the history
These internal lifecycle events aren't being listened to by any
handler. Let's remove it for now and add it back in when there is a
need for them.
  • Loading branch information
ankur22 committed Nov 8, 2022
1 parent 8b6b0da commit 5f57e8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
36 changes: 17 additions & 19 deletions common/event_emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,23 @@ const (

// Page

EventPageClose string = "close"
EventPageConsole string = "console"
EventPageCrash string = "crash"
EventPageDialog string = "dialog"
EventPageDOMContentLoaded string = "domcontentloaded"
EventPageDownload string = "download"
EventPageFilechooser string = "filechooser"
EventPageFrameAttached string = "frameattached"
EventPageFrameDetached string = "framedetached"
EventPageFrameNavigated string = "framenavigated"
EventPageLoad string = "load"
EventPageError string = "pageerror"
EventPagePopup string = "popup"
EventPageRequest string = "request"
EventPageRequestFailed string = "requestfailed"
EventPageRequestFinished string = "requestfinished"
EventPageResponse string = "response"
EventPageWebSocket string = "websocket"
EventPageWorker string = "worker"
EventPageClose string = "close"
EventPageConsole string = "console"
EventPageCrash string = "crash"
EventPageDialog string = "dialog"
EventPageDownload string = "download"
EventPageFilechooser string = "filechooser"
EventPageFrameAttached string = "frameattached"
EventPageFrameDetached string = "framedetached"
EventPageFrameNavigated string = "framenavigated"
EventPageError string = "pageerror"
EventPagePopup string = "popup"
EventPageRequest string = "request"
EventPageRequestFailed string = "requestfailed"
EventPageRequestFinished string = "requestfinished"
EventPageResponse string = "response"
EventPageWebSocket string = "websocket"
EventPageWorker string = "worker"

// Session

Expand Down
11 changes: 0 additions & 11 deletions common/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,11 @@ func (f *Frame) recalculateLifecycle() {
f.childFramesMu.RUnlock()

// Check if any of the fired events should be considered fired when looking at the entire subtree.
mainFrame := f.manager.MainFrame()
for k := range events {
if f.hasSubtreeLifecycleEventFired(k) {
continue
}
f.emit(EventFrameAddLifecycle, k)

if f != mainFrame {
continue
}
switch k {
case LifecycleEventLoad:
f.page.emit(EventPageLoad, nil)
case LifecycleEventDOMContentLoad:
f.page.emit(EventPageDOMContentLoaded, nil)
}
}

f.lifecycleEventsMu.Lock()
Expand Down

0 comments on commit 5f57e8c

Please sign in to comment.