• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 #include "common.h"
17 #include "nodeapi.h"
18 
19 static const char *TAG = "[nodeapi_env]";
20 
testNapiEnv(napi_env env,napi_callback_info info)21 napi_value testNapiEnv(napi_env env, napi_callback_info info)
22 {
23     // pages/nodeapi/datatypes/napienv
24     size_t argc = PARAM2;
25     napi_value argv[PARAM2];
26     napi_status status;
27 
28     // 返回结果
29     napi_value resultValue;
30     status = napi_create_string_utf8(env, "test_napi_env", NAPI_AUTO_LENGTH, &resultValue);
31     if (status != napi_ok) {
32         napi_throw_error(env, NULL, "Failed to create result value");
33         return NULL;
34     }
35 
36     return resultValue;
37 }
38