OnRuntimeAttach
OnRuntimeAttach is a crucial virtual lifecycle method in the LynxExtensionModule class. It is called when the BTS (Background Thread Script) Runtime has been created and is now "attached" to the extension module.
This callback is always invoked on the BTS thread. This is the primary entry point for interacting with the JavaScript environment, such as defining native modules or accessing the VSync observer.
Method Signature
Parameters
Usage
Override this method to perform setup that requires access to the N-API environment. Common use cases include:
- Registering custom native modules using
SetNapiModuleCreator. - Caching the
napi_envfor later use on the BTS thread. - Storing the
vsync_observerto schedule animations.
Example
See Also
Compatibility
LCD tables only load in the browser