qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/ElevationTool.js

2 lines
1.2 KiB
JavaScript

define(["./when-422ea0ae"],(function(e){"use strict";return class{static getDBMap(t,n){let r=e.when.defer(),o=[];for(let r=0;r<t.length;r++){let l=t[r],s=e.when.defer(),u=indexedDB.open(l,1);u.onerror=function(){console.log(l+"数据库创建失败或者异常~"),s.reject()},u.onsuccess=function(e){console.log(l+"数据库连接成功~"),n[l]=e.target.result,s.resolve(!0)},u.onupgradeneeded=function(e){let t=e.target.result;n[l]=t,t.createObjectStore(l,{keyPath:"key",autoIncrement:!1}).createIndex("data","data",{unique:!1}),s.resolve(!0)},o.push(s.promise)}return e.when.all(o,(function(){r.resolve(!0)})),r}static getElevation(t,n,r){let o=e.when.defer(),l=[],s=[];for(let o=0;o<n.length;o++){let u=n[o],c=t[u].transaction([u]).objectStore(u),a=e.when.defer(),i=c.get(r);i.onerror=function(e){s[u]=null,a.resolve(null)},i.onsuccess=function(e){i.result?(s[u]=i.result,a.resolve(i.result)):(s[u]=null,a.resolve(null))},l.push(a.promise)}return e.when.all(l,(function(){o.resolve(s)})),o}static updateElevation(t,n,r,o){let l=e.when.defer(),s=t.transaction([n],"readwrite").objectStore(n).put({key:r,data:o});return s.onsuccess=function(e){l.resolve(!0)},s.onerror=function(e){l.reject()},l}}}));