@impler/angular
Version:
Angular library to show CSV Excel Importer in angular applications
3 lines (2 loc) • 1.07 kB
JavaScript
import{__decorate as e}from"tslib";import{Injectable as i,EventEmitter as t}from"@angular/core";import{logError as s}from"@impler/client";export{ColumnTypes,EventTypes,ValidationTypes}from"@impler/client";let r=class{constructor(){this.isImplerReady=!1,this.widgetEvents=new t(!0)}initializeImpler(){if(this.uuid=this.generateUuid(),window.impler){window.impler.init(this.uuid);const e=setInterval((()=>{window.impler.isReady()&&(this.isImplerReady=!0,clearInterval(e))}),1e3);window.impler.on("message",(e=>{this.widgetEvents.emit(e)}),this.uuid)}else s("IMPLER_UNDEFINED_ERROR")}showWidget(e){this.isImplerReady?window.impler.show(Object.assign(Object.assign({},e),{uuid:this.uuid})):s("IMPLER_UNDEFINED_ERROR")}getReadyState(){return this.isImplerReady}generateUuid(){return window.crypto.getRandomValues(new Uint32Array(1))[0].toString()}closeWidget(){window.impler?window.impler.close():s("IMPLER_UNDEFINED_ERROR")}subscribeToWidgetEvents(e){this.widgetEvents.subscribe(e)}};r=e([i({providedIn:"root"})],r);export{r as ImplerService};
//# sourceMappingURL=index.js.map