Commit eea3b762 authored by Gergely Ujvari's avatar Gergely Ujvari

Rename rpc methods to be more consistent

Between guests <-> sidebar
- `showViewer()` to  `showAnnotations()`
- `updateViewer()` to `updateAnnotations()`
- `toggleViewerSelection()` to `toggleAnnotationSelection()`

All these renames were to enforce encapsulation and these calls
are more like APIs. To guest side really do not have to know anything
what the sidebar has or does.
parent 29b4075f
...@@ -230,17 +230,17 @@ class Annotator.Guest extends Annotator ...@@ -230,17 +230,17 @@ class Annotator.Guest extends Annotator
showAnnotations: (annotations) => showAnnotations: (annotations) =>
@panel?.notify @panel?.notify
method: "showViewer" method: "showAnnotations"
params: (a.$$tag for a in annotations) params: (a.$$tag for a in annotations)
toggleAnnotationSelection: (annotations) => toggleAnnotationSelection: (annotations) =>
@panel?.notify @panel?.notify
method: "toggleViewerSelection" method: "toggleAnnotationSelection"
params: (a.$$tag for a in annotations) params: (a.$$tag for a in annotations)
updateAnnotations: (annotations) => updateAnnotations: (annotations) =>
@panel?.notify @panel?.notify
method: "updateViewer" method: "updateAnnotations"
params: (a.$$tag for a in annotations) params: (a.$$tag for a in annotations)
showEditor: (annotation) => showEditor: (annotation) =>
......
...@@ -154,12 +154,12 @@ class Hypothesis extends Annotator ...@@ -154,12 +154,12 @@ class Hypothesis extends Annotator
this.showEditor this._getLocalAnnotation(tag) this.showEditor this._getLocalAnnotation(tag)
) )
.bind('showViewer', (ctx, tags=[]) => .bind('showAnnotations', (ctx, tags=[]) =>
@element.scope().$apply => @element.scope().$apply =>
this.showViewer this._getLocalAnnotations(tags) this.showViewer this._getLocalAnnotations(tags)
) )
.bind('updateViewer', (ctx, tags=[]) => .bind('updateAnnotations', (ctx, tags=[]) =>
@element.scope().$apply => @element.scope().$apply =>
this.updateViewer this._getLocalAnnotations(tags) this.updateViewer this._getLocalAnnotations(tags)
) )
...@@ -169,7 +169,7 @@ class Hypothesis extends Annotator ...@@ -169,7 +169,7 @@ class Hypothesis extends Annotator
this.focusAnnotations tags this.focusAnnotations tags
) )
.bind('toggleViewerSelection', (ctx, tags=[]) => .bind('toggleAnnotationSelection', (ctx, tags=[]) =>
@element.scope().$apply => @element.scope().$apply =>
this.toggleViewerSelection this._getLocalAnnotations(tags) this.toggleViewerSelection this._getLocalAnnotations(tags)
) )
......
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