/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FOUNDATION_ACE_FRAMEWORKS_DECLARATIVE_FRONTEND_ENGINE_BINDINGS_DEFINES_H #define FOUNDATION_ACE_FRAMEWORKS_DECLARATIVE_FRONTEND_ENGINE_BINDINGS_DEFINES_H #include "frameworks/bridge/declarative_frontend/engine/js_types.h" enum class JavascriptEngine { NONE, ARK }; #ifdef USE_ARK_ENGINE #include "ecmascript/napi/include/jsnapi.h" using BindingTarget = panda::Local; using FunctionCallback = panda::Local(*)(panda::JsiRuntimeCallInfo*); using FunctionGetCallback = panda::Local(*)(panda::JsiRuntimeCallInfo*); using FunctionSetCallback = panda::Local(*)(panda::JsiRuntimeCallInfo*); template using MemberFunctionCallback = panda::Local(T::*)(panda::JsiRuntimeCallInfo*); template using MemberFunctionGetCallback = panda::Local(T::*)(panda::JsiRuntimeCallInfo*); template using MemberFunctionSetCallback = panda::Local(T::*)(panda::JsiRuntimeCallInfo*); using ExoticGetterCallback = int; using ExoticSetterCallback = int; using ExoticHasPropertyCallback = int; using ExoticIsArrayCallback = int; constexpr const JavascriptEngine cCurrentJSEngine = JavascriptEngine::ARK; #else #error "No engine selected" #endif using JSFunctionCallback = void (*)(const OHOS::Ace::Framework::JSCallbackInfo&); template using JSMemberFunctionCallback = void (T::*)(const OHOS::Ace::Framework::JSCallbackInfo&); template using JSDestructorCallback = void (*)(T* instance); template using JSGCMarkCallback = void (*)(T* instance, const OHOS::Ace::Framework::JSGCMarkCallbackInfo&); #endif