Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: emit thumbnailsOpen in DocBaseViewer #977

Merged
merged 1 commit into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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