WebExeBuilder Documentation

licensed

Category: Application Control

Namespace: web.app.licensed

Description

Check if the application is properly licensed. Returns true if a valid license is registered, false if running in trial mode or unlicensed.

Syntax

const isLicensed = await web.app.licensed();

Parameters

None

Returns

Promise<boolean> - True if licensed, false if trial or unlicensed

Example

Simple example

const isLicensed = await web.app.licensed();
console.log('Licensed:', isLicensed);

Practical example

const isLicensed = await web.app.licensed();

if (!isLicensed) {
    alert('You are using a trial version. Please purchase a license.');
}

Advanced example

async function checkFeatureAccess(feature) {
    const isLicensed = await web.app.licensed();
    
    if (!isLicensed && feature === 'export') {
        alert('Export feature requires a license. Please purchase to unlock.');
        return false;
    }
    
    return true;
}

// Usage
document.getElementById('export-btn').addEventListener('click', async () => {
    const canExport = await checkFeatureAccess('export');
    
    if (canExport) {
        await exportData();
    }
});

Use Cases

  • Display trial/licensed status in UI
  • Restrict features in trial mode
  • Show purchase prompts for unlicensed users
  • Display different UI for licensed vs trial
  • Track license status for analytics
  • Enable/disable menu items based on license
  • Show license information in About dialog
  • Implement trial limitations

Error Handling

This method does not throw errors. Always returns a boolean value.

Performance Tips

  • Cache the result at startup
  • Check once and store in application state
  • Use for conditional feature rendering
  • Combine with licenseInfo() for detailed status
  • web.app.licenseInfo() - Get detailed license information
  • web.app.registrationName() - Get registered user name
  • web.app.packageName() - Get license package type
  • web.app.trialInfo() - Get trial expiration details
  • web.app.resetRegistration() - Remove license data

Notes

  • Returns true only if valid license is registered
  • Trial versions return false
  • Unlicensed versions return false
  • Use to implement trial restrictions
  • Check at startup to display appropriate UI