Larry Mickie
Larry Mickie

Reputation: 511

How to find if Electron app is a MAC or MAS Build?

Is there a way to have an is-MAS for Mac Store builds in Electron? I tried looking through the package.json or even a build flag but no luck as of yet. I want to be able to have conditional content that's based on where the user downloads an electron app (Mac Store, Website, etc.).

Thanks in Advance

Upvotes: 1

Views: 674

Answers (1)

Raiponce a tout
Raiponce a tout

Reputation: 76

You can use the process.mas property at run time to test whether an app has been specifically built for the Mac App Store:

process.mas Readonly

A Boolean. For Mac App Store build, this property is true, for other builds it is undefined.

So, a simple isMAS function could be defined as:

function isMAS()
{
    return process.mas || false;
}

Upvotes: 6

Related Questions