Commit bda9db91 authored by Robert Knight's avatar Robert Knight

Remove unused `element` argument from CrossFrame constructor

parent a8b50cf3
...@@ -13,18 +13,13 @@ import { AnnotationSync } from './annotation-sync'; ...@@ -13,18 +13,13 @@ import { AnnotationSync } from './annotation-sync';
* *
* It can be used to publish events to and subscribe to events from the sidebar. * It can be used to publish events to and subscribe to events from the sidebar.
* *
* This class also has logic for injecting Hypothesis into iframes that
* are added to the page if they have the `enable-annotation` attribute set
* and are same-origin with the current document.
*
* @implements Destroyable * @implements Destroyable
*/ */
export class CrossFrame { export class CrossFrame {
/** /**
* @param {Element} element
* @param {EventBus} eventBus - Event bus for communicating with the annotator code (eg. the Guest) * @param {EventBus} eventBus - Event bus for communicating with the annotator code (eg. the Guest)
*/ */
constructor(element, eventBus) { constructor(eventBus) {
this._bridge = new Bridge(); this._bridge = new Bridge();
this._annotationSync = new AnnotationSync(eventBus, this._bridge); this._annotationSync = new AnnotationSync(eventBus, this._bridge);
} }
......
...@@ -163,7 +163,7 @@ export default class Guest { ...@@ -163,7 +163,7 @@ export default class Guest {
this._frameIdentifier = config.subFrameIdentifier || null; this._frameIdentifier = config.subFrameIdentifier || null;
// Setup connection to sidebar. // Setup connection to sidebar.
this.crossframe = new CrossFrame(this.element, eventBus); this.crossframe = new CrossFrame(eventBus);
this.crossframe.onConnect(() => this._setupInitialState(config)); this.crossframe.onConnect(() => this._setupInitialState(config));
this._hypothesisInjector = new HypothesisInjector(this.element, config); this._hypothesisInjector = new HypothesisInjector(this.element, config);
......
...@@ -10,8 +10,7 @@ describe('CrossFrame', () => { ...@@ -10,8 +10,7 @@ describe('CrossFrame', () => {
const createCrossFrame = (options = {}) => { const createCrossFrame = (options = {}) => {
fakeEventBus = {}; fakeEventBus = {};
const element = document.createElement('div'); return new CrossFrame(fakeEventBus, options);
return new CrossFrame(element, fakeEventBus, options);
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -142,7 +142,7 @@ describe('Guest', () => { ...@@ -142,7 +142,7 @@ describe('Guest', () => {
describe('cross frame', () => { describe('cross frame', () => {
it('provides an event bus for the annotation sync module', () => { it('provides an event bus for the annotation sync module', () => {
createGuest(); createGuest();
assert.deepEqual(CrossFrame.lastCall.args[1], eventBus); assert.deepEqual(CrossFrame.lastCall.args[0], eventBus);
}); });
it('publishes the "panelReady" event when a connection is established', () => { it('publishes the "panelReady" event when a connection is established', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment