Commit 78d8a980 authored by Randall Leeds's avatar Randall Leeds

prototype first publisher API: annotator.addToken

proof of concept only. for localwiki.
parent 5f129777
......@@ -65,6 +65,12 @@ class Annotator.Host extends Annotator
parsed[k] = v
parsed
# Build a channel for the publish API
@api = Channel.build
origin: '*'
scope: 'annotator:api'
window: @frame[0].contentWindow
# Build a channel for the panel UI
@panel = Channel.build
origin: '*'
......@@ -257,3 +263,8 @@ class Annotator.Host extends Annotator
# is needed for preventing the panel from closing while annotating.
unless event and this.isAnnotator(event.target)
@mouseIsDown = true
addToken: (token) =>
@api.notify
method: 'addToken'
params: token
\ No newline at end of file
......@@ -127,6 +127,16 @@ class Hypothesis extends Annotator
parsed[k] = v
parsed
@api = Channel.build
origin: $location.search().xdm
scope: 'annotator:api'
window: $window.parent
.bind('addToken', (ctx, token) =>
@element.scope().token = token
@element.scope().$digest()
)
@provider = Channel.build
origin: $location.search().xdm
scope: 'annotator:panel'
......
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