Skip to content

richerfu/node-addon-api-ohos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-addon-api-ohos

Platform License: MIT Ohpm Version

node-addon-api for OpenHarmony/HarmonyNext.

We've made some Harmony-specific adaptations based on node-addon-api, with the aim of providing the same development experience on the Harmony platform.

Usage

Install

ohpm install @ohos-rs/node-addon-api --save-dev

Setup

Edit your CMakeLists.txt in your project and add those code:

set(NODE_ADDON_API_OHOS_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@ohos-rs/node-addon-api)
set(CMAKE_MODULE_PATH ${NODE_ADDON_API_OHOS_ROOT_PATH})

find_package(node_addon_api_ohos REQUIRED)

target_link_libraries(entry PRIVATE node_addon_api_ohos)

Environment

For node-addon-api-ohos, we acccepted the following environment variables:

Name Description Default Value
NAPI_CPP_EXCEPTIONS Allow catch the cpp exception true
NAPI_DISABLE_CPP_EXCEPTIONS Disable catch the cpp exception false
NAPI_NORMAL Hidden some APIs or cases for Harmony true

Build

You can release package locally. Just run command:

bash ./scripts/release.sh

It will generate a .har package in current path. You can import it with file protocol.

Community

Releases

No releases published

Packages

No packages published