mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Use the new "reporttelemetry" event in more viewer components
By utilizing the recently added "reporttelemetry" event, we can avoid having to manually pass in `externalServices` to a number of viewer components.
This commit is contained in:
parent
f2d75d9221
commit
fe60db27b1
3 changed files with 16 additions and 18 deletions
|
@ -25,18 +25,14 @@ class Toolbar {
|
|||
|
||||
#eventBus;
|
||||
|
||||
#externalServices;
|
||||
|
||||
/**
|
||||
* @param {ToolbarOptions} options
|
||||
* @param {EventBus} eventBus
|
||||
* @param {IL10n} _l10n - Localization service.
|
||||
* @param {Object} nimbusData - Nimbus configuration.
|
||||
* @param {Object} externalServices - Interface for external services.
|
||||
*/
|
||||
constructor(options, eventBus, _l10n, nimbusData, externalServices) {
|
||||
constructor(options, eventBus, _l10n, nimbusData) {
|
||||
this.#eventBus = eventBus;
|
||||
this.#externalServices = externalServices;
|
||||
const buttons = [
|
||||
{
|
||||
element: options.download,
|
||||
|
@ -88,9 +84,12 @@ class Toolbar {
|
|||
element.addEventListener("click", evt => {
|
||||
if (eventName !== null) {
|
||||
this.#eventBus.dispatch(eventName, { source: this, ...eventDetails });
|
||||
this.#externalServices.reportTelemetry({
|
||||
type: "gv-buttons",
|
||||
data: { id: `${element.id}_tapped` },
|
||||
this.#eventBus.dispatch("reporttelemetry", {
|
||||
source: this,
|
||||
details: {
|
||||
type: "gv-buttons",
|
||||
data: { id: `${element.id}_tapped` },
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue