Web Method Implementations
Sparkling method SDKs (navigation, storage, media) communicate with the native layer via NativeModules on Android/iOS. On web, NativeModules is unavailable — instead, a web handler registry dispatches method calls to browser-native implementations.
How It Works
When LynxPipe.call() runs on the web:
- It checks if
NativeModulesis available — on web, it isn't. - Before returning an error, it looks up the method name in the web handler registry.
- If a handler is registered, it's invoked with the same params and callback.
- If no handler is found, it returns error code
-3(module not registered).
Built-in Web Methods
Navigation (sparkling-navigation)
Storage (sparkling-storage)
Media (sparkling-media)
Creating a Web Handler for a Custom Method
If you've created a custom method SDK (see Create a Custom Method), you can add web support by following these steps:
1. Create the web handler
Create src/web/index.ts in your method package:
2. Add subpath export
In your method package's package.json, add a ./web export:
3. Update module.config.json
Add "web" to the platforms array:
4. Run autolink
The CLI discovers the web platform entry and generates the appropriate imports so your web handler is loaded automatically.
Testing Web Handlers
Web handlers are plain functions — you can test them in isolation:
Error Handling
If a method is called on web without a registered handler, LynxPipe returns:
You can use this to implement graceful degradation:

