Skip to content

Commit

Permalink
Update: emit thumbnailsOpen in DocBaseViewer (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan authored Apr 4, 2019
1 parent 3b09559 commit 979a912
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export const VIEWER_EVENT = {
mediaEndAutoplay: 'mediaendautoplay', // Media playback has completed, with autoplay enabled.
error: 'error', // When an error occurs.
default: 'viewerevent', // The default viewer event.
metric: 'viewermetric' // A viewer metric.
metric: 'viewermetric', // A viewer metric.
thumbnailsClose: 'thumbnailsClose', // When thumbnails sidebar closes
thumbnailsOpen: 'thumbnailsOpen' // When thumbnails sidebar opens
};

// Error codes logged by preview with "preview_error" events
Expand Down
5 changes: 3 additions & 2 deletions src/lib/viewers/doc/DocBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class DocBaseViewer extends BaseViewer {

if (this.shouldThumbnailsBeToggled()) {
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_OPEN);
this.emit(VIEWER_EVENT.thumbnailsOpen);
}
}
}
Expand Down Expand Up @@ -1363,13 +1364,13 @@ class DocBaseViewer extends BaseViewer {
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_CLOSE);
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_CLOSE_ACTIVE);
metricName = USER_DOCUMENT_THUMBNAIL_EVENTS.CLOSE;
eventName = 'thumbnailsClose';
eventName = VIEWER_EVENT.thumbnailsClose;
} else {
this.rootEl.classList.remove(CLASS_BOX_PREVIEW_THUMBNAILS_CLOSE);
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_OPEN);
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_OPEN_ACTIVE);
metricName = USER_DOCUMENT_THUMBNAIL_EVENTS.OPEN;
eventName = 'thumbnailsOpen';
eventName = VIEWER_EVENT.thumbnailsOpen;
}

this.emitMetric({ name: metricName, data: pagesCount });
Expand Down

0 comments on commit 979a912

Please sign in to comment.