-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoint.storage.local.min.js
More file actions
14 lines (8 loc) · 1.9 KB
/
joint.storage.local.min.js
File metadata and controls
14 lines (8 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*! Rappid v3.1.1 - HTML5 Diagramming Framework - TRIAL VERSION
Copyright (c) 2015 client IO
2020-06-11
This Source Code Form is subject to the terms of the Rappid Trial License
, v. 2.0. If a copy of the Rappid License was not distributed with this
file, You can obtain one at http://jointjs.com/license/rappid_v2.txt
or from the Rappid archive as was distributed by client IO. See the LICENSE file.*/
this.joint=this.joint||{},function(t,l){"use strict";var e={prefix:"joint.storage",insert:function(t,e,i){var n=e.id||l.util.uuid(),s=this.loadIndex(t);-1===s.keys.indexOf(n)&&s.keys.push(n),this.setItem(this.docKey(t,n),e),this.setItem(this.indexKey(t),s),this.callback(i,null,l.util.assign({},e,{id:n}))},find:function(i,t,n){var e=this.loadIndex(i),s=[];if(l.util.isEmpty(t))e.keys.forEach(function(t){var e=this.getItem(this.docKey(i,t));e||this.callback(n,new Error("Storage incosistency. No document found for an ID "+t+" from index.")),s.push(e)},this),this.callback(n,null,s);else if(t.id){var o=this.getItem(this.docKey(i,t.id));this.callback(n,null,o?[o]:[])}else this.callback(n,null,[])},remove:function(e,i,t){var n=this.loadIndex(e);l.util.isEmpty(i)?(n.keys.forEach(function(t){localStorage.removeItem(this.docKey(e,t))},this),localStorage.removeItem(this.indexKey(e)),this.callback(t,null)):i.id&&(n.keys=n.keys.filter(function(t){return t!==i.id}),localStorage.removeItem(this.docKey(e,i.id)),this.setItem(this.indexKey(e),n),this.callback(t,null))},callback:function(t,e,i){t&&setTimeout(function(){t(e,i)},1)},setItem:function(t,e){localStorage.setItem(t,JSON.stringify(e))},getItem:function(t){var e=localStorage.getItem(t);return e?JSON.parse(e):e},loadIndex:function(t){var e=this.getItem(this.indexKey(t))||{};return e.keys=e.keys||[],e},docKey:function(t,e){return this.prefix+"."+t+".docs."+e},indexKey:function(t){return this.prefix+"."+t+".index"}};t.Local=e}(this.joint.storage=this.joint.storage||{},joint);