Mehtab
Mehtab

Reputation: 15

How to convert Reveal Module Pattern in JavaScript to Typescript when function is taking global as argument

I am rewriting(code refactoring) the Javascript code into Typescript. I face a problem when converting reveal module Pattern into typescript namespace. The only thing that I don't understand is the role of global here. I really don't know what this global means here.

//My Javascript Code

 var TPS = (function(global)
    {
    var met = {
        supported: TPSSupported,
        isCalledDNMatchesTPS: isCalledDNMatchesTPS,
        isTPSReady: isTPSReady,
        isActiveCall: isActiveCall
}
        return met;

    })(this);

//My solution

  namespace TPS {
     export let met = {
            supported: TPSSupported,
            isCalledDNMatchesTPS: isCalledDNMatchesTPS,
            isTPSReady: isTPSReady,
            isActiveCall: isActiveCall
            }
    }

Upvotes: 1

Views: 57

Answers (0)

Related Questions