UNPKG

@tindtechnologies/universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

2 lines (1 loc) 2.01 kB
var o=function(u,i,r,a){return new(r||(r=Promise))(function(n,e){function f(t){try{s(a.next(t))}catch(l){e(l)}}function c(t){try{s(a.throw(t))}catch(l){e(l)}}function s(t){t.done?n(t.value):new r(function(l){l(t.value)}).then(f,c)}s((a=a.apply(u,i||[])).next())})},h=function(u,i){var r={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},a,n,e,f;return f={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function c(t){return function(l){return s([t,l])}}function s(t){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,n&&(e=t[0]&2?n.return:t[0]?n.throw||((e=n.return)&&e.call(n),0):n.next)&&!(e=e.call(n,t[1])).done)return e;switch(n=0,e&&(t=[t[0]&2,e.value]),t[0]){case 0:case 1:e=t;break;case 4:return r.label++,{value:t[1],done:!1};case 5:r.label++,n=t[1],t=[0];continue;case 7:t=r.ops.pop(),r.trys.pop();continue;default:if(e=r.trys,!(e=e.length>0&&e[e.length-1])&&(t[0]===6||t[0]===2)){r=0;continue}if(t[0]===3&&(!e||t[1]>e[0]&&t[1]<e[3])){r.label=t[1];break}if(t[0]===6&&r.label<e[1]){r.label=e[1],e=t;break}if(e&&r.label<e[2]){r.label=e[2],r.ops.push(t);break}e[2]&&r.ops.pop(),r.trys.pop();continue}t=i.call(u,r)}catch(l){t=[6,l],n=0}finally{a=e=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}},w=void 0,v=function(u,i,r,a,n){return o(w,void 0,void 0,function(){var e;return h(this,function(f){switch(f.label){case 0:if(u)return[2,u.attachViewToDom(i,r,n,a)];if(typeof r!="string"&&!(r instanceof HTMLElement))throw new Error("framework delegate is missing");return e=typeof r=="string"?i.ownerDocument&&i.ownerDocument.createElement(r):r,a&&a.forEach(function(c){return e.classList.add(c)}),n&&Object.assign(e,n),i.appendChild(e),e.componentOnReady?[4,e.componentOnReady()]:[3,2];case 1:f.sent(),f.label=2;case 2:return[2,e]}})})},y=function(u,i){if(i){if(u){var r=i.parentElement;return u.removeViewFromDom(r,i)}i.remove()}return Promise.resolve()};export{v as a,y as b};