LCAddOn

@protocol LCAddOn <NSObject>

Supported addons must expose an object that implements this protocol.

  • When require('<MODULE_NAME>.node') is called from JavaScript, this method will be triggered if this addon was registered to handle <MODULE_NAME>. This method muar execute the __register_<MODULE_NAME>() static function created from NODE_MODULE_* macros in node.h.

    Declaration

    Objective-C

    - (void)register:(NSString *)module;

    Swift

    func register(_ module: String!)

    Parameters

    module

    The name of the module to register.

  • Each time require() is called for this module from JS, this method will be triggered before returning the bound object to the caller. This is an opportunity to attach anything else to the object that may be required from Objective-C or Swift before returning it to the caller.

    Declaration

    Objective-C

    - (void)require:(JSValue *)binding service:(LCMicroService *)service;

    Swift

    func require(_ binding: JSValue!, service: LCMicroService!)

    Parameters

    binding

    The native binding object.

    service

    The LCMicroService of this process