The method used by OpenHarmony/HarmonyOS to determine whether the current device supports this module.

A method to determine whether the current device supports the module.

Author: Nuts
Team: Nuts Pie
Public Account: "Big Front-End Journey"
Runkaihong technical expert, Huawei HDE, InfoQ contracted author, OpenHarmony evangelist, good at HarmonyOS application development, familiar with service card development, in the "Battle Code Pioneer" activity As the team leader, Zhong has cultivated three small team leaders and led 100+ team members to complete the submission and integration of Pr.
Welcome to contact me through the homepage or private message, join Nuts, and learn OpenHarmony/HarmonyO application development together.

Developers can import modules through import. If the current device does not support the module, the result of import will be undefined. Developers need to determine whether it exists when using its API.

import controller from '@ohos.nfc.controller';
   try {
   
    
    
    controller.enableNfc()

Guess you like

Origin blog.csdn.net/qq_39132095/article/details/131360414