Skip to content

Commit

Permalink
Explicitly initialize an EventBus instance (#593)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Ott <dan@dtott.com>
  • Loading branch information
wojtekmaj and danieltott authored Jun 16, 2020
1 parent ba9422e commit 26a3cea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Document.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Message from './Message';

import LinkService from './LinkService';
import PasswordResponses from './PasswordResponses';
import eventBus from './eventBus';

import {
cancelRunningTask,
Expand Down Expand Up @@ -60,7 +61,7 @@ export default class Document extends PureComponent {
},
};

linkService = new LinkService();
linkService = new LinkService({ eventBus });

componentDidMount() {
this.loadDocument();
Expand Down
3 changes: 2 additions & 1 deletion src/Page/AnnotationLayer.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { pdfjs } from '../entry.jest';

import { AnnotationLayerInternal as AnnotationLayer } from './AnnotationLayer';
import LinkService from '../LinkService';
import eventBus from '../eventBus';

import failingPage from '../../__mocks__/_failing_page';

Expand All @@ -17,7 +18,7 @@ const pdfFile = loadPDF('./__mocks__/_pdf.pdf');
/* eslint-disable comma-dangle */

describe('AnnotationLayer', () => {
const linkService = new LinkService();
const linkService = new LinkService({ eventBus });

// Loaded page
let page;
Expand Down
3 changes: 3 additions & 0 deletions src/eventBus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { EventBus } from 'pdfjs-dist/lib/web/ui_utils';

export default new EventBus();

0 comments on commit 26a3cea

Please sign in to comment.