Skip to content

Commit

Permalink
added: onBeforeInit event
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Panico committed May 10, 2024
1 parent 93c861e commit d4efb7b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ export class AppComponent implements OnInit {
this.SUPPORT_MODE = this.g.supportMode
}

this.triggerOnBeforeInit('onBeforeInit')

});
this.globalSettingsService.initParamiters(this.g, this.el);

Expand Down Expand Up @@ -1669,10 +1671,15 @@ export class AppComponent implements OnInit {


private triggerOnAuthStateChanged(event){
const detailOBJ = { event: event, isLogged: true, user: this.tiledeskAuthService.getCurrentUser() , appConfigs: this.appConfigProvider.getConfig() }
const detailOBJ = { event: event, isLogged: true, user: this.tiledeskAuthService.getCurrentUser() }
this.triggerEvents.triggerOnAuthStateChanged(detailOBJ)
}

private triggerOnBeforeInit(event){
const detailOBJ = { event: event, isLogged: true, user: this.tiledeskAuthService.getCurrentUser() }
this.triggerEvents.triggerOnBeforeInit(detailOBJ)
}


// @HostListener('mouseenter', ['$event'])
// onMouseEnter(event: any) {
Expand Down
14 changes: 14 additions & 0 deletions src/app/services/triggerEvents/triggerEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,19 @@ export class TriggerEvents {

}

public triggerOnBeforeInit(detailObj: {}) {
this.logger.debug(' ---------------- triggerOnBeforeInitEvent ---------------- ', detailObj);
try {
const onBeforeInit = new CustomEvent('onBeforeInit', { detail: detailObj });
const windowContext = this.windowContext;
if (windowContext){
// windowContext.document.dispatchEvent(onNewConversation);
windowContext.postMessage({type: "onBeforeInit", detail: detailObj }, '*')
}
} catch (e) {
this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
}
}


}

0 comments on commit d4efb7b

Please sign in to comment.