SDK for building Sparkling methods that bridge JavaScript and native code through LynxPipe.
npm install sparkling-method@latestimport LynxPipe from 'sparkling-method';
// Callback-based call
LynxPipe.call('methodName', { param: 'value' }, (response) => {
console.log(response);
});
// Promise-based call
const result = await LynxPipe.callAsync('methodName', { param: 'value' });
// Event handling
const handler = LynxPipe.on('eventName', (data) => console.log(data));
LynxPipe.off('eventName', handler);| Method | Description |
|---|---|
call(method, params, callback) |
Call native method with callback |
callAsync(method, params) |
Call native method with Promise |
on(event, callback) |
Subscribe to native event |
off(event, callback) |
Unsubscribe from native event |