Skip to content

Commit

Permalink
Merge pull request #8351 from Snuffleupagus/eslint_object-shorthand-web
Browse files Browse the repository at this point in the history
Enable the `object-shorthand` ESLint rule in `web`
  • Loading branch information
timvandermeij authored Apr 29, 2017
2 parents 165294a + 2a0207c commit 5fb779d
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 180 deletions.
2 changes: 1 addition & 1 deletion web/annotation_layer_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AnnotationLayerBuilder {
* @param {string} intent (default value is 'display')
*/
render(viewport, intent = 'display') {
this.pdfPage.getAnnotations({ intent }).then((annotations) => {
this.pdfPage.getAnnotations({ intent, }).then((annotations) => {
var parameters = {
viewport: viewport.clone({ dontFlip: true }),
div: this.div,
Expand Down
74 changes: 37 additions & 37 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ function configure(PDFJS) {
}

var DefaultExternalServices = {
updateFindControlState: function (data) {},
initPassiveLoading: function (callbacks) {},
fallback: function (data, callback) {},
reportTelemetry: function (data) {},
createDownloadManager: function () {
updateFindControlState(data) {},
initPassiveLoading(callbacks) {},
fallback(data, callback) {},
reportTelemetry(data) {},
createDownloadManager() {
throw new Error('Not implemented: createDownloadManager');
},
createPreferences() {
Expand Down Expand Up @@ -181,7 +181,7 @@ var PDFViewerApplication = {
/**
* @private
*/
_readPreferences: function () {
_readPreferences() {
var { preferences, viewerPrefs, } = this;

return Promise.all([
Expand Down Expand Up @@ -257,20 +257,20 @@ var PDFViewerApplication = {
/**
* @private
*/
_initializeViewerComponents: function () {
_initializeViewerComponents() {
var self = this;
var appConfig = this.appConfig;

return new Promise((resolve, reject) => {
var eventBus = appConfig.eventBus || getGlobalEventBus();
self.eventBus = eventBus;
this.eventBus = eventBus;

var pdfRenderingQueue = new PDFRenderingQueue();
pdfRenderingQueue.onIdle = self.cleanup.bind(self);
self.pdfRenderingQueue = pdfRenderingQueue;

var pdfLinkService = new PDFLinkService({
eventBus: eventBus
eventBus,
});
self.pdfLinkService = pdfLinkService;

Expand All @@ -280,12 +280,12 @@ var PDFViewerApplication = {
var container = appConfig.mainContainer;
var viewer = appConfig.viewerContainer;
self.pdfViewer = new PDFViewer({
container: container,
viewer: viewer,
eventBus: eventBus,
container,
viewer,
eventBus,
renderingQueue: pdfRenderingQueue,
linkService: pdfLinkService,
downloadManager: downloadManager,
downloadManager,
renderer: self.viewerPrefs['renderer'],
enhanceTextSelection: self.viewerPrefs['enhanceTextSelection'],
renderInteractiveForms: self.viewerPrefs['renderInteractiveForms'],
Expand All @@ -304,7 +304,7 @@ var PDFViewerApplication = {

self.pdfHistory = new PDFHistory({
linkService: pdfLinkService,
eventBus: eventBus,
eventBus,
});
pdfLinkService.setHistory(self.pdfHistory);

Expand Down Expand Up @@ -353,10 +353,10 @@ var PDFViewerApplication = {

if (self.supportsFullscreen) {
self.pdfPresentationMode = new PDFPresentationMode({
container: container,
viewer: viewer,
container,
viewer,
pdfViewer: self.pdfViewer,
eventBus: eventBus,
eventBus,
contextMenuItems: appConfig.fullscreen
});
}
Expand All @@ -365,14 +365,14 @@ var PDFViewerApplication = {

self.pdfOutlineViewer = new PDFOutlineViewer({
container: appConfig.sidebar.outlineView,
eventBus: eventBus,
eventBus,
linkService: pdfLinkService,
});

self.pdfAttachmentViewer = new PDFAttachmentViewer({
container: appConfig.sidebar.attachmentsView,
eventBus: eventBus,
downloadManager: downloadManager,
eventBus,
downloadManager,
});

// FIXME better PDFSidebar constructor parameters
Expand Down Expand Up @@ -482,31 +482,31 @@ var PDFViewerApplication = {
if (typeof PDFJSDev !== 'undefined' &&
PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
this.externalServices.initPassiveLoading({
onOpenWithTransport: function (url, length, transport) {
PDFViewerApplication.open(url, {range: transport});
onOpenWithTransport(url, length, transport) {
PDFViewerApplication.open(url, { range: transport, });

if (length) {
PDFViewerApplication.pdfDocumentProperties.setFileSize(length);
}
},
onOpenWithData: function (data) {
onOpenWithData(data) {
PDFViewerApplication.open(data);
},
onOpenWithURL: function (url, length, originalURL) {
onOpenWithURL(url, length, originalURL) {
var file = url, args = null;
if (length !== undefined) {
args = {length: length};
args = { length, };
}
if (originalURL !== undefined) {
file = {file: url, originalURL: originalURL};
file = { file: url, originalURL, };
}
PDFViewerApplication.open(file, args);
},
onError: function (e) {
onError(err) {
PDFViewerApplication.error(mozL10n.get('loading_error', null,
'An error occurred while loading the PDF.'), e);
'An error occurred while loading the PDF.'), err);
},
onProgress: function (loaded, total) {
onProgress(loaded, total) {
PDFViewerApplication.progress(loaded / total);
}
});
Expand Down Expand Up @@ -674,7 +674,7 @@ var PDFViewerApplication = {
}

var moreInfo = {
message: message
message,
};
self.error(loadingErrorMessage, moreInfo);

Expand Down Expand Up @@ -728,7 +728,7 @@ var PDFViewerApplication = {
}
this.fellback = true;
this.externalServices.fallback({
featureId: featureId,
featureId,
url: this.baseUrl,
}, function response(download) {
if (!download) {
Expand Down Expand Up @@ -1019,10 +1019,10 @@ var PDFViewerApplication = {

Promise.all([onePageRendered, animationStarted]).then(function() {
pdfDocument.getOutline().then(function(outline) {
self.pdfOutlineViewer.render({ outline: outline });
self.pdfOutlineViewer.render({ outline, });
});
pdfDocument.getAttachments().then(function(attachments) {
self.pdfAttachmentViewer.render({ attachments: attachments });
self.pdfAttachmentViewer.render({ attachments, });
});
});

Expand Down Expand Up @@ -1086,7 +1086,7 @@ var PDFViewerApplication = {
type: 'documentInfo',
version: versionId,
generator: generatorId,
formType: formType
formType,
});
}
});
Expand Down Expand Up @@ -1322,7 +1322,7 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
'An error occurred while loading the PDF.');

var moreInfo = {
message: message
message,
};
PDFViewerApplication.error(loadingErrorMessage, moreInfo);
throw e;
Expand Down Expand Up @@ -1582,7 +1582,7 @@ function webViewerPageRendered(e) {
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
PDFViewerApplication.externalServices.reportTelemetry({
type: 'documentStats',
stats: stats
stats,
});
});
}
Expand Down Expand Up @@ -2206,7 +2206,7 @@ localized.then(function webViewerLocalized() {
var PDFPrintServiceFactory = {
instance: {
supportsPrinting: false,
createPrintService: function () {
createPrintService() {
throw new Error('Not implemented: createPrintService');
}
}
Expand Down
4 changes: 2 additions & 2 deletions web/chromecom.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ var ChromeCom = {};
*/
ChromeCom.request = function ChromeCom_request(action, data, callback) {
var message = {
action: action,
data: data
action,
data,
};
if (!chrome.runtime) {
console.error('chrome.runtime is undefined.');
Expand Down
16 changes: 8 additions & 8 deletions web/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,14 @@ var Stats = (function Stats() {
name: 'Stats',
panel: null,
manager: null,
init: function init(pdfjsLib) {
init(pdfjsLib) {
this.panel.setAttribute('style', 'padding: 5px;');
pdfjsLib.PDFJS.enableStats = true;
},
enabled: false,
active: false,
// Stats specific functions.
add: function(pageNumber, stat) {
add(pageNumber, stat) {
if (!stat) {
return;
}
Expand All @@ -485,7 +485,7 @@ var Stats = (function Stats() {
statsDiv.textContent = stat.toString();
wrapper.appendChild(title);
wrapper.appendChild(statsDiv);
stats.push({ pageNumber: pageNumber, div: wrapper });
stats.push({ pageNumber, div: wrapper, });
stats.sort(function(a, b) {
return a.pageNumber - b.pageNumber;
});
Expand All @@ -494,7 +494,7 @@ var Stats = (function Stats() {
this.panel.appendChild(stats[i].div);
}
},
cleanup: function () {
cleanup() {
stats = [];
clear(this.panel);
}
Expand All @@ -513,7 +513,7 @@ window.PDFBug = (function PDFBugClosure() {
StepperManager,
Stats
],
enable: function(ids) {
enable(ids) {
var all = false, tools = this.tools;
if (ids.length === 1 && ids[0] === 'all') {
all = true;
Expand All @@ -535,7 +535,7 @@ window.PDFBug = (function PDFBugClosure() {
});
}
},
init: function init(pdfjsLib, container) {
init(pdfjsLib, container) {
/*
* Basic Layout:
* PDFBug
Expand Down Expand Up @@ -588,14 +588,14 @@ window.PDFBug = (function PDFBugClosure() {
}
this.selectPanel(0);
},
cleanup: function cleanup() {
cleanup() {
for (var i = 0, ii = this.tools.length; i < ii; i++) {
if (this.tools[i].enabled) {
this.tools[i].cleanup();
}
}
},
selectPanel: function selectPanel(index) {
selectPanel(index) {
if (typeof index !== 'number') {
index = this.tools.indexOf(index);
}
Expand Down
9 changes: 4 additions & 5 deletions web/firefox_print_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function FirefoxPrintService(pdfDocument, pagesOverview, printContainer) {
}

FirefoxPrintService.prototype = {
layout: function () {
layout() {
var pdfDocument = this.pdfDocument;
var printContainer = this.printContainer;
var body = document.querySelector('body');
Expand All @@ -86,7 +86,7 @@ FirefoxPrintService.prototype = {
}
},

destroy: function () {
destroy() {
this.printContainer.textContent = '';
}
};
Expand All @@ -99,9 +99,8 @@ PDFPrintServiceFactory.instance = {
return shadow(this, 'supportsPrinting', value);
},

createPrintService: function (pdfDocument, pagesOverview, printContainer) {
return new FirefoxPrintService(pdfDocument, pagesOverview,
printContainer);
createPrintService(pdfDocument, pagesOverview, printContainer) {
return new FirefoxPrintService(pdfDocument, pagesOverview, printContainer);
}
};

Expand Down
Loading

0 comments on commit 5fb779d

Please sign in to comment.