mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 23:28:06 +02:00
Remove the undocumented PDFJS.enableStats
option
In order to simplify things, the undocumented `enableStats` option was removed and `pdfBug` is now instead used to enabled general debugging *and* page request/rendering stats. Considering that in the default viewer the `stats` was only used when debugging was also enabled, this simplification (code wise) definitely seem worthwhile to me.
This commit is contained in:
parent
6bc3e1fb93
commit
e95c11a7f0
5 changed files with 5 additions and 11 deletions
|
@ -333,8 +333,7 @@ let PDFViewerApplication = {
|
|||
}
|
||||
if ('pdfbug' in hashParams) {
|
||||
PDFJS.pdfBug = true;
|
||||
let pdfBug = hashParams['pdfbug'];
|
||||
let enabled = pdfBug.split(',');
|
||||
let enabled = hashParams['pdfbug'].split(',');
|
||||
waitOn.push(loadAndEnablePDFBug(enabled));
|
||||
}
|
||||
// Locale can be changed only when special debugging flags is present in
|
||||
|
@ -1558,7 +1557,6 @@ function loadAndEnablePDFBug(enabledTabs) {
|
|||
script.onload = function () {
|
||||
PDFBug.enable(enabledTabs);
|
||||
PDFBug.init({
|
||||
PDFJS,
|
||||
OPS,
|
||||
}, appConfig.mainContainer);
|
||||
resolve();
|
||||
|
@ -1723,8 +1721,7 @@ function webViewerPageRendered(evt) {
|
|||
thumbnailView.setImage(pageView);
|
||||
}
|
||||
|
||||
if (PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled &&
|
||||
pageView.stats) {
|
||||
if (typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) {
|
||||
Stats.add(pageNumber, pageView.stats);
|
||||
}
|
||||
|
||||
|
@ -2013,7 +2010,7 @@ function webViewerPageChanging(evt) {
|
|||
}
|
||||
|
||||
// we need to update stats
|
||||
if (PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled) {
|
||||
if (typeof Stats !== 'undefined' && Stats.enabled) {
|
||||
let pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);
|
||||
if (pageView && pageView.stats) {
|
||||
Stats.add(page, pageView.stats);
|
||||
|
|
|
@ -462,7 +462,6 @@ var Stats = (function Stats() {
|
|||
manager: null,
|
||||
init(pdfjsLib) {
|
||||
this.panel.setAttribute('style', 'padding: 5px;');
|
||||
pdfjsLib.PDFJS.enableStats = true;
|
||||
},
|
||||
enabled: false,
|
||||
active: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue