Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-holy-pipe

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-holy-pipe

Define android handler for specified JS function call

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@thinhvu/capacitor-holy-pipe

Holy pipe - Provide a flexible way to send signal/call Android function from JS side. (IOS not supported yet)

Install

npm install capacitor-holy-pipe
npx cap sync

API

  • echo(...)

echo(...)

import { HolyPipe } from 'capacitor-holy-pipe';
const login = (username, password, rememberPassword) => HolyPipe.echo({ 
  action: 'login', 
  params: { username, password, rememberPassword } 
}, (resp) => {
  const loginResult = resp.value.loginResult
  console.log('loginResult', loginResult)
});
import com.sfbl.capacitor.holypipe.HolyPipePlugin;

public class MainActivity extends BridgeActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        HolyPipePlugin.actions.put("login", call -> {
            JSObject params = call.getObject("params");
            String username = params.getString("username");
            String password = params.getString("password");
            Boolean rememberPassword = params.getBool("rememberPassword");
            Boolean result = this.login(username, password, rememberPassword);
            JSObject resp = new JSObject();
            resp.put("loginResult", result);
            call.resolve(resp);
        });
    }
    
    protected void login(String username, String password, Boolean rememberPassword) {
        // ...
        return false;
    }
}
ParamType
options{ action: string, params: any }

Returns: Promise<{ value: any; }>


Roadmap

  • Replace PluginCall mechanism with Capacitor "native bridge" to trigger, handle event from both side.
      HolyPipe.on('android-to-js', (params, callback) => { /* do something */ })
      HolyPipe.emit('js-to-android', param1, param2, param3, ..., (response) => {});
    
        HolyPipePlugin.emit('android-to-js', param1, param2, ..., (response) -> {});
        HolyPipePlugin.on('js-to-android', (param1, param2, ..., callback) -> { /* ... do something */ });
    

Keywords

FAQs

Package last updated on 20 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc