• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "frameworks/bridge/declarative_frontend/engine/functions/js_animation_on_finish_function.h"
17 
18 namespace OHOS::Ace::Framework {
19 
Execute(bool isDebugAnim)20 void JsAnimationOnFinishFunction::Execute(bool isDebugAnim)
21 {
22     auto vm = jsFunction_->GetEcmaVM();
23     panda::TryCatch trycatch(vm);
24     if (isDebugAnim) {
25         if (jsFunction_->GetHandle().IsEmpty() || !jsFunction_->GetHandle()->IsFunction(vm) || trycatch.HasCaught()) {
26             TAG_LOGW(AceLogTag::ACE_ANIMATION,
27                 "call function handle is empty or not function, empty: %{public}d, hasError: %{public}d",
28                 jsFunction_->GetHandle().IsEmpty(), trycatch.HasCaught());
29         } else {
30             TAG_LOGI(AceLogTag::ACE_ANIMATION,
31                 "call function: %{public}s", jsFunction_->GetHandle()->GetName(vm)->ToString(vm).c_str());
32         }
33     }
34     auto result = ExecuteJS();
35     if (isDebugAnim && !result.IsEmpty()) {
36         TAG_LOGI(
37             AceLogTag::ACE_ANIMATION, "call function result: %{public}s", result->ToString().c_str());
38     }
39 }
40 
41 } // namespace OHOS::Ace::Framework
42