Commit f800d425 authored by Randall Leeds's avatar Randall Leeds

small fixes to bridge callbacks

- It's important to always parse the result, even if there's no
  callback parameter, since it will cause a merge to happen.
- We shouldn't call the error callback if it doesn't exist.
parent 6745e359
......@@ -116,30 +116,38 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
@channel.call
method: 'createAnnotation'
params: tag
success: (annotation) => cb? null, this._parse annotation
error: cb
success: (annotation) =>
annotation = this._parse annotation
cb? null, annotation
error: (error, reason) => cb? {error, reason}
tag
setupAnnotation: (annotation, cb) ->
@channel.call
method: 'setupAnnotation'
params: this._format annotation
success: (annotation) => cb? null, this._parse annotation
error: cb
success: (annotation) =>
annotation = this._parse annotation
cb? null, annotation
error: (error, reason) => cb? {error, reason}
updateAnnotation: (annotation, cb) ->
@channel.call
method: 'updateAnnotation'
params: this._format annotation
success: (annotation) => cb? null, this._parse annotation
error: cb
success: (annotation) =>
annotation = this._parse annotation
cb? null, annotation
error: (error, reason) => cb? {error, reason}
deleteAnnotation: (annotation, cb) ->
@channel.notify
method: 'deleteAnnotation'
params: this._format annotation
success: (annotation) => cb? null, this._parse annotation
error: cb
success: (annotation) =>
annotation = this._parse annotation
cb? null, annotation
error: (error, reason) => cb? {error, reason}
showEditor: (annotation) ->
@channel.notify
......
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