Convert the files in the /web folder to ES6 modules

Note that as discussed on IRC, this makes the viewer slightly slower to load *only* in `gulp server` mode, however the difference seem slight enough that I think it will be fine.
This commit is contained in:
Jonas Jenwald 2017-03-28 01:07:27 +02:00
parent 313060aff5
commit 3b35c15d42
32 changed files with 1585 additions and 2045 deletions

View file

@ -13,29 +13,16 @@
* limitations under the License.
*/
'use strict';
import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { PDFViewerApplication } from 'pdfjs-web/app';
import { Preferences } from 'pdfjs-web/preferences';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences',
'pdfjs-web/app', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./preferences.js'), require('./app.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences,
root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, preferences, app, pdfjsLib) {
if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
throw new Error('Module "pdfjs-web/firefoxcom" shall not be used outside ' +
'FIREFOX and MOZCENTRAL builds.');
}
var Preferences = preferences.Preferences;
var PDFViewerApplication = app.PDFViewerApplication;
var FirefoxCom = (function FirefoxComClosure() {
return {
/**
@ -291,6 +278,7 @@ document.mozL10n.setExternalLocalizerServices({
}
});
exports.DownloadManager = DownloadManager;
exports.FirefoxCom = FirefoxCom;
}));
export {
DownloadManager,
FirefoxCom,
};