1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Enable the ESLint no-var rule in the examples/ folder

Updating the examples to use `let`/`const` should be fine, given that they are available in all browsers/platforms that the PDF.js library now supports; please note the following compatibility information:

 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const#browser_compatibility
This commit is contained in:
Jonas Jenwald 2021-03-12 17:12:41 +01:00
parent 276fa4ad8f
commit 5c712f2131
3 changed files with 10 additions and 3 deletions

View file

@ -8,4 +8,9 @@
"pdfjsLib": false, "pdfjsLib": false,
"pdfjsViewer": false, "pdfjsViewer": false,
}, },
"rules": {
// ECMAScript 6
"no-var": "error",
},
} }

View file

@ -35,7 +35,7 @@ const MIN_SCALE = 0.25;
const MAX_SCALE = 10.0; const MAX_SCALE = 10.0;
const DEFAULT_SCALE_VALUE = "auto"; const DEFAULT_SCALE_VALUE = "auto";
var PDFViewerApplication = { const PDFViewerApplication = {
pdfLoadingTask: null, pdfLoadingTask: null,
pdfDocument: null, pdfDocument: null,
pdfViewer: null, pdfViewer: null,
@ -425,6 +425,8 @@ var PDFViewerApplication = {
}, },
}; };
window.PDFViewerApplication = PDFViewerApplication;
document.addEventListener( document.addEventListener(
"DOMContentLoaded", "DOMContentLoaded",
function () { function () {

View file

@ -188,9 +188,9 @@ DOMElementSerializer.prototype = {
this._loopIndex = 0; this._loopIndex = 0;
/* falls through */ /* falls through */
case 5: // Serialize child nodes (only for non-tspan/style elements). case 5: // Serialize child nodes (only for non-tspan/style elements).
var value;
while (true) { while (true) {
value = this._childSerializer && this._childSerializer.getNext(); const value =
this._childSerializer && this._childSerializer.getNext();
if (value !== null) { if (value !== null) {
return value; return value;
} }