Merge pull request #11426 from wojtekmaj/viewer-const

Use const in viewer.js
This commit is contained in:
Tim van der Meij 2019-12-23 22:29:15 +01:00 committed by GitHub
commit 2de0447e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error, prefer-const: error */
'use strict'; 'use strict';
@ -21,12 +22,12 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
(function rewriteUrlClosure() { (function rewriteUrlClosure() {
// Run this code outside DOMContentLoaded to make sure that the URL // Run this code outside DOMContentLoaded to make sure that the URL
// is rewritten as soon as possible. // is rewritten as soon as possible.
let queryString = document.location.search.slice(1); const queryString = document.location.search.slice(1);
let m = /(^|&)file=([^&]*)/.exec(queryString); const m = /(^|&)file=([^&]*)/.exec(queryString);
defaultUrl = m ? decodeURIComponent(m[2]) : ''; defaultUrl = m ? decodeURIComponent(m[2]) : '';
// Example: chrome-extension://.../http://example.com/file.pdf // Example: chrome-extension://.../http://example.com/file.pdf
let humanReadableUrl = '/' + defaultUrl + location.hash; const humanReadableUrl = '/' + defaultUrl + location.hash;
history.replaceState(history.state, '', humanReadableUrl); history.replaceState(history.state, '', humanReadableUrl);
if (top === window) { if (top === window) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
@ -184,7 +185,7 @@ function getViewerConfiguration() {
} }
function webViewerLoad() { function webViewerLoad() {
let config = getViewerConfiguration(); const config = getViewerConfiguration();
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) { if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
Promise.all([ Promise.all([
SystemJS.import('pdfjs-web/app'), SystemJS.import('pdfjs-web/app'),