I'm just starting out with Typescript
and I could use some guidance in deciphering a piece of code.
The code snippet is as follows:
addSilentCallBackHandler(): void {
this.mgr.signinSilentCallback().then(callback());
}
function callback(): (value: any) => void | PromiseLike<void> {
return (data: any) => {
console.debug("callback");
};
}
In the code, when this.mgr.signinSilentCallback()
is called, it triggers the 'then' function. My goal is to pass the callback
function as an argument in the addSilentCallBackHandler
method. However, I am struggling with the syntax. The return type seems to be a function that again returns another function? Can someone please clarify how the callback
function works?
By the way, mgr
refers to the 'UserManager' within the OidcClient library, which is used for JWT token management.