src/js/serializers/ldt_localstorage.js
changeset 1072 ac1eacb3aa33
parent 1068 7623f9af9272
--- a/src/js/serializers/ldt_localstorage.js	Sun Nov 12 22:07:33 2017 +0100
+++ b/src/js/serializers/ldt_localstorage.js	Wed Sep 04 17:32:50 2024 +0200
@@ -1,10 +1,7 @@
 /* ldt_localstorage serializer: Used to store personal annotations in local storage */
+import _ from "lodash";
 
-if (typeof IriSP.serializers === "undefined") {
-    IriSP.serializers = {};
-}
-
-IriSP.serializers.ldt_localstorage = {
+const ldt_localstorage = function(IriSP) { return {
     serializeAnnotation : function(_data, _source) {
         var _annType = _data.getAnnotationType();
         return {
@@ -45,7 +42,7 @@
             _source.getAnnotationTypes().push(_anntype);
         }
         _ann.setAnnotationType(_anntype.id);
-        var _tagIds = IriSP._(_anndata.tags).map(function(_title) {
+        var _tagIds = _(_anndata.tags).map(function(_title) {
             var _tags = _source.getTags(true).searchByTitle(_title, true);
             if (_tags.length) {
                 var _tag = _tags[0];
@@ -82,6 +79,8 @@
         _source.addList('annotation', new IriSP.Model.List(_source.directory));
         _data.map( function (a) { _this.deserializeAnnotation(a, _source); });
     }
-};
+}};
+
+export default ldt_localstorage;
 
 /* End ldt_localstorage serializer */