Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
bda9db91
Commit
bda9db91
authored
Oct 07, 2021
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused `element` argument from CrossFrame constructor
parent
a8b50cf3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
10 deletions
+4
-10
cross-frame.js
src/annotator/cross-frame.js
+1
-6
guest.js
src/annotator/guest.js
+1
-1
cross-frame-test.js
src/annotator/test/cross-frame-test.js
+1
-2
guest-test.js
src/annotator/test/guest-test.js
+1
-1
No files found.
src/annotator/cross-frame.js
View file @
bda9db91
...
@@ -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
(
e
lement
,
e
ventBus
)
{
constructor
(
eventBus
)
{
this
.
_bridge
=
new
Bridge
();
this
.
_bridge
=
new
Bridge
();
this
.
_annotationSync
=
new
AnnotationSync
(
eventBus
,
this
.
_bridge
);
this
.
_annotationSync
=
new
AnnotationSync
(
eventBus
,
this
.
_bridge
);
}
}
...
...
src/annotator/guest.js
View file @
bda9db91
...
@@ -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
);
...
...
src/annotator/test/cross-frame-test.js
View file @
bda9db91
...
@@ -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
(()
=>
{
...
...
src/annotator/test/guest-test.js
View file @
bda9db91
...
@@ -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'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment