1 /* 2 * Copyright (c) 2022 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 FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_INTERFACES_KITS_NAPI_INCLUDE_COMMON_WANT 17 #define FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_INTERFACES_KITS_NAPI_INCLUDE_COMMON_WANT 18 19 #include <string> 20 #include <vector> 21 22 #include "napi/native_api.h" 23 #include "want_params.h" 24 25 namespace OHOS { 26 namespace WorkScheduler { 27 /** 28 * @brief Unwrap napi value to WantParams object. 29 * 30 * @param env The environment that the Node-API call is invoked under. 31 * @param param The napi value parameters. 32 * @param wantParams Indicates the WantParams object containing the new parameters. 33 * 34 * @return True if success,else false. 35 */ 36 bool UnwrapWantParams(napi_env env, napi_value param, AAFwk::WantParams &wantParams); 37 38 /** 39 * @brief Wrap WantParams object to napi value. 40 * 41 * @param env The environment that the Node-API call is invoked under. 42 * @param wantParams Indicates the WantParams object containing the new parameters. 43 * 44 * @return napi value result. 45 */ 46 napi_value WrapWantParams(napi_env env, const AAFwk::WantParams &wantParams); 47 } // namespace WorkScheduler 48 } // namespace OHOS 49 #endif // FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_INTERFACES_KITS_NAPI_INCLUDE_COMMON_WANT 50