changeset 1583:a07a557b6e39

annotator-dl: add events for annotator store plugin to report raw database results
author hertzhaft
date Fri, 02 Dec 2016 18:13:05 +0100
parents 14a6d8a8a307
children 817a5c42cb1b
files webapp/src/main/webapp/jquery/annotator-dl.js
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/annotator-dl.js	Wed Nov 30 23:21:09 2016 +0100
+++ b/webapp/src/main/webapp/jquery/annotator-dl.js	Fri Dec 02 18:13:05 2016 +0100
@@ -2277,6 +2277,7 @@
       var _this = this;
       if (__indexOf.call(this.annotations, annotation) >= 0) {
         return this._apiRequest('destroy', annotation, (function() {
+          _this.publish("annotationDestroyed", [annotation]);
           return _this.unregisterAnnotation(annotation);
         }));
       }
@@ -2291,6 +2292,7 @@
     };
 
     Store.prototype.updateAnnotation = function(annotation, data) {
+      this.publish("annotationStored", [annotation, data]);
       if (__indexOf.call(this.annotations, annotation) < 0) {
         console.error(Annotator._t("Trying to update unregistered annotation!"));
       } else {
@@ -2305,6 +2307,7 @@
 
     Store.prototype._onLoadAnnotations = function(data) {
       var a, annotation, annotationMap, newData, _k, _l, _len2, _len3, _ref3;
+      this.publish("annotationRead", [this.annotations, data]);
       if (data == null) {
         data = [];
       }
@@ -2336,6 +2339,7 @@
       if (data == null) {
         data = {};
       }
+      this.publish("annotationSearchResult", [this.annotations, data]);
       return this._onLoadAnnotations(data.rows || []);
     };