1 /* 2 * Copyright (c) 2024 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 #ifndef ABILITY_DMSFWK_JS_CONTINUATION_STATE_MANAGER_H 16 #define ABILITY_DMSFWK_JS_CONTINUATION_STATE_MANAGER_H 17 18 #include "js_continuation_state_manager_stub.h" 19 #include "ability.h" 20 21 #include "native_engine/native_engine.h" 22 #include "napi_base_context.h" 23 24 namespace OHOS { 25 namespace DistributedSchedule { 26 class JsContinuationStateManager { 27 public: 28 static napi_value ContinueStateCallbackOn(napi_env env, napi_callback_info info); 29 static napi_value ContinueStateCallbackOff(napi_env env, napi_callback_info info); 30 static napi_value MakeContinueStateCodeEnumObject(napi_env env); 31 private: 32 static sptr<DistributedSchedule::JsContinuationStateManagerStub> CreateStub( 33 napi_env env, napi_callback_info info, const bool isRegisterOn); 34 static void GetAbilityContext(std::shared_ptr<AbilityRuntime::AbilityContext> &abilityContext, 35 napi_env env, napi_value context); 36 static napi_status MakeEnumItem(const napi_env &env, napi_value object, const char* name, int32_t value); 37 private: 38 static std::map<std::string, sptr<DistributedSchedule::JsContinuationStateManagerStub>> callbackStubs_; 39 }; 40 napi_value JsContinuationStateManagerInit(napi_env env, napi_value exportObj); 41 } // namespace DistributedSchedule 42 } // namespace OHOS 43 #endif //ABILITY_DMSFWK_JS_CONTINUATION_STATE_MANAGER_H 44