VoltronJSEngine constructor
VoltronJSEngine(
- EngineInitParams params,
- VoltronBundleLoader? preloadBundleLoader
Implementation
VoltronJSEngine(EngineInitParams params, VoltronBundleLoader? preloadBundleLoader) {
// create core bundle loader
VoltronBundleLoader? coreBundleLoader;
if (!isEmpty(params.coreJSAssetsPath)) {
if (params.coreAssetsLoader != null) {
coreBundleLoader = params.coreAssetsLoader;
} else {
coreBundleLoader = AssetBundleLoader(
params.coreJSAssetsPath!,
canUseCodeCache: !isEmpty(params.codeCacheTag),
codeCacheTag: params.codeCacheTag,
);
}
} else if (!isEmpty(params.coreJSFilePath)) {
if (params.coreFileLoader != null) {
coreBundleLoader = params.coreFileLoader;
} else {
coreBundleLoader = FileBundleLoader(
params.coreJSFilePath,
canUseCodeCache: !isEmpty(params.codeCacheTag),
codeCacheTag: params.codeCacheTag,
);
}
}
try {
LogUtils.d(_kTag, "init ffi function binding start");
_initBridge();
LogUtils.d(_kTag, "init ffi function binding done");
} catch (e) {
_currentState = EngineState.initError;
if (e is Error) {
LogUtils.e(_kTag, "init ffi function binding fail, error: ${e.stackTrace}");
}
}
_id = VoltronApi.getVoltronEngineIndex();
LogUtils.d(_kTag, "get voltron engine index: ${_id}");
CookieManager.getInstance().setCookieDelegate(
params.cookieDelegateType,
originDelegate: params.originDelegate,
);
var configs = GlobalConfigs(params);
_globalConfigs = configs;
_coreBundleLoader = coreBundleLoader;
_preloadBundleLoader = preloadBundleLoader;
_apiProviders = params.providers;
_debugMode = params.debugMode;
_integratedMode = params.integratedMode;
_serverBundleName = params.debugMode ? params.debugBundleName : "";
_startTimeMonitor = TimeMonitor(true);
_engineMonitor = params.engineMonitor!;
_serverHost = params.debugServerHost;
_remoteServerUrl = params.remoteServerUrl ?? '';
_groupId = params.groupId;
_thirdPartyAdapter = params.thirdPartyAdapter;
}