mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-19 22:54:50 -04:00
continueAbility support
Signed-off-by: huzeqi <huzeqi@huawei.com> Change-Id: I9b1c39de83004cd9c0683127a987b293729d9c53
This commit is contained in:
@@ -2682,6 +2682,17 @@ void JsiEngineInstance::RegisterI18nPluralRulesModule()
|
||||
global->SetProperty(runtime_, "i18nPluralRules", i18nObj);
|
||||
}
|
||||
|
||||
void JsiEngineInstance::RegisterFaPlugin()
|
||||
{
|
||||
shared_ptr<JsValue> global = runtime_->GetGlobal();
|
||||
shared_ptr<JsValue> requireNapiFunc = global->GetProperty(runtime_, "requireNapi");
|
||||
if (!requireNapiFunc || !requireNapiFunc->IsFunction(runtime_)) {
|
||||
LOGW("requireNapi func not found");
|
||||
}
|
||||
std::vector<shared_ptr<JsValue>> argv = { runtime_->NewString("FeatureAbility") };
|
||||
requireNapiFunc->Call(runtime_, global, argv, argv.size());
|
||||
}
|
||||
|
||||
bool JsiEngineInstance::InitJsEnv(bool debugger_mode, const std::unordered_map<std::string, void*>& extraNativeObject)
|
||||
{
|
||||
ACE_SCOPED_TRACE("JsiEngine::InitJsEnv");
|
||||
@@ -2828,6 +2839,7 @@ bool JsiEngine::Initialize(const RefPtr<FrontendDelegate>& delegate)
|
||||
nativeEngine->SetPackagePath(packagePath);
|
||||
}
|
||||
}
|
||||
engineInstance_->RegisterFaPlugin();
|
||||
RegisterWorker();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -64,11 +64,13 @@ public:
|
||||
return frontendDelegate_;
|
||||
}
|
||||
|
||||
void RegisterFaPlugin(); // load ReatureAbility plugin
|
||||
|
||||
private:
|
||||
void RegisterAceModule(); // add ace object to global
|
||||
void RegisterConsoleModule(); // add Console object to global
|
||||
void RegisterSyscapModule(); // add Syscap object to global
|
||||
void RegisterDocumentModule(); // add dom object to global
|
||||
void RegisterSyscapModule(); // add Syscap object to global
|
||||
void RegisterDocumentModule(); // add dom object to global
|
||||
void RegisterPerfUtilModule(); // add perfutil object to global
|
||||
void RegisterHiViewModule(); // add hiView object to global
|
||||
void RegisterI18nPluralRulesModule(); // add i18nPluralRules object to global
|
||||
|
||||
@@ -381,6 +381,9 @@ bool FrontendDelegateImpl::OnStartContinuation()
|
||||
ret = delegate->onStartContinuationCallBack_();
|
||||
}
|
||||
}, TaskExecutor::TaskType::JS);
|
||||
if (!ret) {
|
||||
ret = FireSyncEvent("_root", std::string("\"onStartContinuation\","), std::string(""));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -392,6 +395,7 @@ void FrontendDelegateImpl::OnCompleteContinuation(int32_t code)
|
||||
delegate->onCompleteContinuationCallBack_(code);
|
||||
}
|
||||
}, TaskExecutor::TaskType::JS);
|
||||
FireSyncEvent("_root", std::string("\"onCompleteContinuation\","), std::to_string(code));
|
||||
}
|
||||
|
||||
void FrontendDelegateImpl::OnRemoteTerminated()
|
||||
@@ -413,6 +417,9 @@ void FrontendDelegateImpl::OnSaveData(std::string& data)
|
||||
delegate->onSaveDataCallBack_(savedData);
|
||||
}
|
||||
}, TaskExecutor::TaskType::JS);
|
||||
if (savedData.empty()) {
|
||||
FireSyncEvent("_root", std::string("\"onSaveData\","), std::string(""), savedData);
|
||||
}
|
||||
std::string pageUri = GetRunningPageUrl();
|
||||
data = std::string("{\"url\":\"").append(pageUri).append("\",\"__remoteData\":").append(savedData).append("}");
|
||||
}
|
||||
@@ -426,6 +433,7 @@ bool FrontendDelegateImpl::OnRestoreData(const std::string& data)
|
||||
ret = delegate->onRestoreDataCallBack_(data);
|
||||
}
|
||||
}, TaskExecutor::TaskType::JS);
|
||||
FireSyncEvent("_root", std::string("\"onSaveData\","), data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user