From 1e10c09c82dec7c272693f59974c49b1032e45b3 Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Tue, 13 Jun 2017 23:19:41 +0200 Subject: [PATCH] remove unnecessary global functions --- main.js | 4 ---- pdf.js | 38 -------------------------------------- 2 files changed, 42 deletions(-) diff --git a/main.js b/main.js index 475e02b..eae5efc 100644 --- a/main.js +++ b/main.js @@ -49,8 +49,4 @@ var viewer; createBrowserApi(opts).then(initViewer); }); - - global.pdfLoaded = new Promise(function(resolve, reject) { - window.addEventListener('pdf-loaded', resolve) - }); })() diff --git a/pdf.js b/pdf.js index 0460bd4..61032bb 100644 --- a/pdf.js +++ b/pdf.js @@ -262,44 +262,6 @@ function PDFViewer(browserApi) { // Request translated strings. cr.sendWithPromise('getStrings').then(this.handleStrings_.bind(this)); - - // Setup global functions for scripting from electron - global.fitToWidth = function() { - this.zoomToolbar_.fitToWidth(); - }.bind(this); - - global.fitToPage = function() { - this.zoomToolbar_.fitToPage(); - }.bind(this); - - global.zoomIn = function() { - this.viewport_.zoomIn.apply(this.viewport_); - }.bind(this); - - global.zoomOut = function() { - this.viewport_.zoomOut.apply(this.viewport_); - }.bind(this); - - global.rotate = function(cw = true) { - if (cw) this.rotateClockwise_(); - else this.rotateCounterClockwise_(); - }.bind(this); - - global.getMostVisiblePage = function() { - return this.viewport_.getMostVisiblePage.apply(this.viewport_); - }.bind(this); - - global.getPageCount = function() { - return this.viewport_.pageDimensions_.length; - }.bind(this); - - global.goToPage = function(page) { - return this.viewport_.goToPage.call(this.viewport_, page); - }.bind(this); - - global.getPageDimensions = function(page) { - return this.viewport_.pageDimensions_[page]; - }.bind(this); } PDFViewer.prototype = {