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

Replace a few occurences of var with let in already ES6 converted web/ files #9058

Merged
merged 1 commit into from
Oct 22, 2017
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
2 changes: 1 addition & 1 deletion web/pdf_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ function isDestArraysEqual(firstDest, secondDest) {
if (Object.keys(first).length !== Object.keys(second).length) {
return false;
}
for (var key in first) {
for (let key in first) {
if (!isEntryEqual(first[key], second[key])) {
return false;
}
Expand Down
14 changes: 7 additions & 7 deletions web/pdf_rendering_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,28 @@ class PDFRenderingQueue {
* 2. if last scrolled down, the page after the visible pages, or
* if last scrolled up, the page before the visible pages
*/
var visibleViews = visible.views;
let visibleViews = visible.views;

var numVisible = visibleViews.length;
let numVisible = visibleViews.length;
if (numVisible === 0) {
return false;
}
for (var i = 0; i < numVisible; ++i) {
var view = visibleViews[i].view;
for (let i = 0; i < numVisible; ++i) {
let view = visibleViews[i].view;
if (!this.isViewFinished(view)) {
return view;
}
}

// All the visible views have rendered; try to render next/previous pages.
if (scrolledDown) {
var nextPageIndex = visible.last.id;
let nextPageIndex = visible.last.id;
// IDs start at 1, so no need to add 1.
if (views[nextPageIndex] && !this.isViewFinished(views[nextPageIndex])) {
return views[nextPageIndex];
}
} else {
var previousPageIndex = visible.first.id - 2;
let previousPageIndex = visible.first.id - 2;
if (views[previousPageIndex] &&
!this.isViewFinished(views[previousPageIndex])) {
return views[previousPageIndex];
Expand Down Expand Up @@ -162,7 +162,7 @@ class PDFRenderingQueue {
break;
case RenderingStates.INITIAL:
this.highestPriorityPage = view.renderingId;
var continueRendering = () => {
let continueRendering = () => {
this.renderHighestPriority();
};
view.draw().then(continueRendering, continueRendering);
Expand Down
12 changes: 6 additions & 6 deletions web/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

import { cloneObj } from './ui_utils';

var defaultPreferences = null;
let defaultPreferences = null;
function getDefaultPreferences() {
if (!defaultPreferences) {
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {
defaultPreferences = Promise.resolve(
PDFJSDev.json('$ROOT/web/default_preferences.json'));
} else {
defaultPreferences = new Promise(function (resolve) {
var xhr = new XMLHttpRequest();
let xhr = new XMLHttpRequest();
xhr.open('GET', 'default_preferences.json');
xhr.onload = xhr.onerror = function loaded() {
try {
Expand Down Expand Up @@ -130,8 +130,8 @@ class BasePreferences {
} else if (value === undefined) {
throw new Error('Set preference: no value is specified.');
}
var valueType = typeof value;
var defaultType = typeof this.defaults[name];
let valueType = typeof value;
let defaultType = typeof this.defaults[name];

if (valueType !== defaultType) {
if (valueType === 'number' && defaultType === 'string') {
Expand All @@ -158,12 +158,12 @@ class BasePreferences {
*/
get(name) {
return this._initializedPromise.then(() => {
var defaultValue = this.defaults[name];
let defaultValue = this.defaults[name];

if (defaultValue === undefined) {
throw new Error(`Get preference: "${name}" is undefined.`);
} else {
var prefValue = this.prefs[name];
let prefValue = this.prefs[name];

if (prefValue !== undefined) {
return prefValue;
Expand Down