[JS] Extract EventSubmitter interface
The Integration
interface is bloated – an implementation will have many different responsibilities. One of those responsibilities is submitting events to the event ingestion service via Integration#enqueueEvent()
. Extract this responsibility into the EventSubmitter
interface.
Changes
- Extract the
EventSubmitter
interface - Extract the
DefaultEventSubmitter
class from theDefaultIntegration
class - Create the
BrowserEventSubmitter
class, which batches events and submits them every 5 seconds, or when the page is backgrounded or unloaded-
BrowserEventSubmitter
duplicates the logic frommw.eventLogging/BackgroundQueue.js
. This is deliberate. It removes our dependency on EventLogging to submit events to the event ingestion service
-
Bug: T366827