UNPKG

@impler/angular

Version:

Angular library to show CSV Excel Importer in angular applications

3 lines (2 loc) 1.41 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("@angular/core"),t=require("@impler/client");exports.ImplerService=class{constructor(){this.isImplerReady=!1,this.widgetEvents=new r.EventEmitter(!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 t.logError("IMPLER_UNDEFINED_ERROR")}showWidget(e){this.isImplerReady?window.impler.show(Object.assign(Object.assign({},e),{uuid:this.uuid})):t.logError("IMPLER_UNDEFINED_ERROR")}getReadyState(){return this.isImplerReady}generateUuid(){return window.crypto.getRandomValues(new Uint32Array(1))[0].toString()}closeWidget(){window.impler?window.impler.close():t.logError("IMPLER_UNDEFINED_ERROR")}subscribeToWidgetEvents(e){this.widgetEvents.subscribe(e)}},exports.ImplerService=e.__decorate([r.Injectable({providedIn:"root"})],exports.ImplerService),Object.defineProperty(exports,"ColumnTypes",{enumerable:!0,get:function(){return t.ColumnTypes}}),Object.defineProperty(exports,"EventTypes",{enumerable:!0,get:function(){return t.EventTypes}}),Object.defineProperty(exports,"ValidationTypes",{enumerable:!0,get:function(){return t.ValidationTypes}}); //# sourceMappingURL=index.js.map