All Products
Search
Document Center

SuperApp:White-label JSAPIs for mini programs

Last Updated:Jun 04, 2026

The SDK lets you configure a custom namespace and JSAPI class name prefix for mini programs. To enable this feature, contact us.

Default behavior

By default, mini programs call JSAPIs using the WindVane namespace and the WV class name prefix:

const authorize = () =>{
  window.WindVane.call('WVAuthorize', 'authorize', {}, function(e) { ... }, function(e) { ... });
};
document.addEventListener('WV.Event.WVBluetooth.characteristicValueChanged', function(e) { ... }, false);

To use a custom namespace and prefix, configure the following parameters in EMASMiniAppInitConfig:

Parameter

Type

Default

Description

superAppNameSpace

String

"WindVane"

The window object name that mini programs use to access JSAPIs.

jsApiClassNamePrefix

String

"WV"

The class name prefix for JSAPI calls and event listeners.

windvaneBackwardCompatible

Boolean

true

Specifies whether to maintain backward compatibility with mini programs that use the WindVane namespace and WV prefix.

Configure custom namespace and prefix

New parameters

To use a custom namespace and prefix, configure the following parameters in EMASMiniAppInitConfig:

  1. superAppNameSpace: Sets the window object name that mini programs use to access JSAPIs. The default value is "WindVane".

  2. jsApiClassNamePrefix: Sets the custom JSAPI class name prefix. The default value is "WV".

  3. windvaneBackwardCompatible: A Boolean that specifies whether to maintain backward compatibility with mini programs that use the WindVane namespace and WV prefix. The default value is true.

Parameter

Type

Default

Description

superAppNameSpace

String

"WindVane"

The window object name that mini programs use to access JSAPIs.

jsApiClassNamePrefix

String

"WV"

The class name prefix for JSAPI calls and event listeners.

windvaneBackwardCompatible

Boolean

true

Specifies whether to maintain backward compatibility with mini programs that use the WindVane namespace and WV prefix.

Set the three parameters in your initConfig method:

- (void)initConfig {

    EMASMiniAppInitConfig *miniAppInitConfig = [EMASMiniAppInitConfig new];

    ...

    // New configuration items
    miniAppInitConfig.windvaneBackwardCompatible = YES;
    miniAppInitConfig.superAppNameSpace = @"your NameSpace";
    miniAppInitConfig.jsApiClassNamePrefix = @"your ClassNamePrefix";

    ...

    EMASMiniAppServiceImpl *miniAppService = [EMASMiniAppServiceImpl new];
    [miniAppService initialize:miniAppInitConfig];

}

Example

This example sets superAppNameSpace to "SuperApp" and jsApiClassNamePrefix to "SA":

- (void)initConfig {

    EMASMiniAppInitConfig *miniAppInitConfig = [EMASMiniAppInitConfig new];

    ...

    // New configuration items
    miniAppInitConfig.windvaneBackwardCompatible = YES;
    miniAppInitConfig.superAppNameSpace = @"SuperApp";
    miniAppInitConfig.jsApiClassNamePrefix = @"SA";

    ...

    EMASMiniAppServiceImpl *miniAppService = [EMASMiniAppServiceImpl new];
    [miniAppService initialize:miniAppInitConfig];

}

With this configuration, the namespace changes from WindVane to SuperApp and the class name prefix changes from WV to SA. The following code shows JSAPI calls before and after the change:

// JSAPI call before customization
const authorize = () =>{
  window.WindVane.call('WVAuthorize', 'authorize', {}, function(e) { ... }, function(e) { ... });
};
document.addEventListener('WV.Event.WVBluetooth.characteristicValueChanged', function(e) { ... }, false);

// JSAPI call after customization
const authorize = () =>{
    window.SuperApp.call('SAAuthorize', 'authorize', {}, function(e) { ... }, function(e) { ... });
};
document.addEventListener('SA.Event.SABluetooth.characteristicValueChanged', function(e) {
  ...
}, false);

Configuration scenarios

Use the scenario that matches your mini program deployment:

  1. Default namespace only: If all your mini programs use the default WindVane namespace and WV prefix, no configuration is required. The SDK applies these defaults automatically.

  2. Custom namespace only: If all your mini programs use a custom namespace and prefix, set windvaneBackwardCompatible to NO:

- (void)initConfig {

    EMASMiniAppInitConfig *miniAppInitConfig = [EMASMiniAppInitConfig new];

    ...

    // New configuration items
    miniAppInitConfig.windvaneBackwardCompatible = NO;
    miniAppInitConfig.superAppNameSpace = @"your NameSpace";
    miniAppInitConfig.jsApiClassNamePrefix = @"your ClassNamePrefix";

    ...

    EMASMiniAppServiceImpl *miniAppService = [EMASMiniAppServiceImpl new];
    [miniAppService initialize:miniAppInitConfig];

}
  1. Mixed: legacy and custom: If you need to support both older mini programs that use the WindVane/WV identifiers and newer mini programs that use a custom namespace and prefix, set windvaneBackwardCompatible to YES:

- (void)initConfig {

    EMASMiniAppInitConfig *miniAppInitConfig = [EMASMiniAppInitConfig new];

    ...

    // New configuration items
    miniAppInitConfig.windvaneBackwardCompatible = YES;
    miniAppInitConfig.superAppNameSpace = @"your NameSpace";
    miniAppInitConfig.jsApiClassNamePrefix = @"your ClassNamePrefix";

    ...

    EMASMiniAppServiceImpl *miniAppService = [EMASMiniAppServiceImpl new];
    [miniAppService initialize:miniAppInitConfig];

}