UNPKG

@ionic/core

Version:
1 lines 797 B
import*as tslib_1 from"../polyfills/tslib.js";function attachComponent(e,t,n,o,r){return tslib_1.__awaiter(this,void 0,void 0,function(){var a;return tslib_1.__generator(this,function(i){switch(i.label){case 0:if(e)return[2,e.attachViewToDom(t,n,r,o)];if("string"!=typeof n&&!(n instanceof HTMLElement))throw new Error("framework delegate is missing");return a="string"==typeof n?t.ownerDocument&&t.ownerDocument.createElement(n):n,o&&o.forEach(function(e){return a.classList.add(e)}),r&&Object.assign(a,r),t.appendChild(a),a.componentOnReady?[4,a.componentOnReady()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2,a]}})})}function detachComponent(e,t){if(t){if(e)return e.removeViewFromDom(t.parentElement,t);t.remove()}return Promise.resolve()}export{attachComponent as a,detachComponent as b};