Commit cab82d20 authored by Gerben's avatar Gerben Committed by Aron Carroll

Add on and emit functions for bridge plugin

Not too pretty..
parent 19d096a1
......@@ -56,6 +56,20 @@ class Annotator.Guest extends Annotator
discoveryOptions: {}
bridgeOptions: {}
annotationSyncOptions:
on: (event, handler) =>
this.subscribe(event, handler)
emit: (event, args...) =>
switch event
# AnnotationSync tries to emit some events without taking actions.
# We catch them and perform the right action (which will then emit
# the event for real)
when 'annotationDeleted'
this.deleteAnnotation(annotation)
when 'loadAnnotations'
this.loadAnnotations args...
# Other events can simply be emitted.
else
this.publish(event, args...)
formatter: (annotation) =>
formatted = {}
formatted['uri'] = @getHref()
......
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