1 /* 2 * Copyright (c) 2023-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 OHOS_ABILITY_JS_ENVIRONMENT_JS_ENVIRONMENT_IMPL_H 17 #define OHOS_ABILITY_JS_ENVIRONMENT_JS_ENVIRONMENT_IMPL_H 18 19 #include <string> 20 #include "event_handler.h" 21 #include "native_engine/native_engine.h" 22 23 namespace OHOS { 24 namespace JsEnv { 25 struct WorkerInfo; 26 class JsEnvironmentImpl { 27 public: JsEnvironmentImpl()28 JsEnvironmentImpl() {} ~JsEnvironmentImpl()29 virtual ~JsEnvironmentImpl() {} 30 31 virtual void PostTask(const std::function<void()>& task, const std::string& name, int64_t delayTime) = 0; 32 33 virtual void PostSyncTask(const std::function<void()>& task, const std::string& name) = 0; 34 35 virtual void RemoveTask(const std::string& name) = 0; 36 37 virtual void InitTimerModule(NativeEngine* engine) = 0; 38 39 virtual void InitConsoleModule(NativeEngine* engine) = 0; 40 41 virtual bool InitLoop(NativeEngine* engine, bool isStage = true) = 0; 42 43 virtual void DeInitLoop(NativeEngine* engine) = 0; 44 45 virtual void InitWorkerModule(NativeEngine* engine, std::shared_ptr<WorkerInfo> workerInfo) = 0; 46 47 virtual void InitSyscapModule() = 0; 48 }; 49 } // namespace JsEnv 50 } // namespace OHOS 51 #endif // OHOS_ABILITY_JS_ENVIRONMENT_JS_ENVIRONMENT_IMPL_H