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 #ifndef PANDA_PLUGINS_ETS_RUNTIME_INTEROP_JS_INTEROP_CONTEXT_API_H 17 #define PANDA_PLUGINS_ETS_RUNTIME_INTEROP_JS_INTEROP_CONTEXT_API_H 18 19 #include "libpandabase/macros.h" 20 21 namespace ark::ets { 22 23 class EtsCoroutine; 24 25 namespace interop::js { 26 27 /** 28 * @brief The external function that creates the main interop context instance and does all other 29 * required initialization (i.e. initalizes various modules, XGC and other things). Intended to be used by 30 * the modules that should be isolated from the interop implementation details (e.g. ANI). This 31 * requirement demands the use of void* instead of napi_env. 32 * 33 * @param mainCoro The main coroutine instance 34 * @param napiEnv The napi_env for the main JSVM instance 35 */ 36 PANDA_PUBLIC_API bool CreateMainInteropContext(ark::ets::EtsCoroutine *mainCoro, void *napiEnv); 37 38 } // namespace interop::js 39 40 } // namespace ark::ets 41 42 #endif // !PANDA_PLUGINS_ETS_RUNTIME_INTEROP_JS_INTEROP_CONTEXT_API_H