From 5b50e0d414623371449e514a50592c02b3e0c18a Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Thu, 9 Feb 2017 09:53:52 -0600 Subject: [PATCH] Replaces RequireJS to SystemJS. --- .eslintrc | 2 +- examples/helloworld/hello.js | 8 +++--- examples/helloworld/index.html | 3 ++- examples/svgviewer/index.html | 3 ++- examples/svgviewer/viewer.js | 9 ++++--- package.json | 2 +- src/worker_loader.js | 27 ++++++++++---------- systemjs.config.js | 45 ++++++++++++++++++++++++++++++++++ test/font/font_test.html | 3 ++- test/font/jasmine-boot.js | 10 +++++--- test/test_slave.html | 16 ++++++------ test/unit/jasmine-boot.js | 38 ++++++++++++---------------- test/unit/unit_test.html | 3 ++- web/viewer.html | 3 ++- web/viewer.js | 10 +++++--- 15 files changed, 118 insertions(+), 64 deletions(-) create mode 100644 systemjs.config.js diff --git a/.eslintrc b/.eslintrc index 6187b253d..d034a3ce6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -12,8 +12,8 @@ globals: { "PDFJSDev": false, - "require": false, "exports": false, + "SystemJS": false, }, "rules": { diff --git a/examples/helloworld/hello.js b/examples/helloworld/hello.js index 3571b59a6..b4421b6d0 100644 --- a/examples/helloworld/hello.js +++ b/examples/helloworld/hello.js @@ -1,8 +1,10 @@ 'use strict'; -// In production, the bundled pdf.js shall be used instead of RequireJS. -require.config({paths: {'pdfjs': '../../src'}}); -require(['pdfjs/display/api', 'pdfjs/display/global'], function (api, global) { +// In production, the bundled pdf.js shall be used instead of SystemJS. +Promise.all([SystemJS.import('pdfjs/display/api'), + SystemJS.import('pdfjs/display/global')]) + .then(function (modules) { + var api = modules[0], global = modules[1]; // In production, change this to point to the built `pdf.worker.js` file. global.PDFJS.workerSrc = '../../src/worker_loader.js'; diff --git a/examples/helloworld/index.html b/examples/helloworld/index.html index 4b44fd21c..e27316eac 100644 --- a/examples/helloworld/index.html +++ b/examples/helloworld/index.html @@ -2,7 +2,8 @@ - + + diff --git a/examples/svgviewer/index.html b/examples/svgviewer/index.html index 70bf357ed..2b19c29f7 100644 --- a/examples/svgviewer/index.html +++ b/examples/svgviewer/index.html @@ -6,7 +6,8 @@ PDF.js SVG viewer example - + +