• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_NAPI_ACE_COMPONENT_SNAPSHOT_H
17 #define OHOS_NAPI_ACE_COMPONENT_SNAPSHOT_H
18 
19 #include <functional>
20 #include <memory>
21 
22 #include "js_native_api.h"
23 #include "js_native_api_types.h"
24 
25 namespace OHOS::Media {
26 class PixelMap;
27 } // namespace OHOS::Media
28 
29 namespace OHOS::Ace::Napi {
30 class JsComponentSnapshot {
31 public:
32     JsComponentSnapshot(napi_env env, napi_callback_info info);
33 
34     bool CheckArgs(napi_valuetype firstArgType);
35 
36     auto CreateCallback(napi_value* result);
37 
38     napi_value GetArgv(int32_t idx);
39 
40     static constexpr int32_t ARGC_MAX = 2;
41 
42 private:
43     napi_env env_ = nullptr;
44     napi_value argv_[ARGC_MAX] { nullptr };
45     size_t argc_ = ARGC_MAX;
46 };
47 } // namespace OHOS::Ace::Napi
48 
49 #endif