Socket
Socket
Sign inDemoInstall

ngx-electron-bridge

Package Overview
Dependencies
80
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-electron-bridge

Isolated context bridge library for Electron & Angular applications


Version published
Weekly downloads
9
increased by800%
Maintainers
1
Install size
117 kB
Created
Weekly downloads
 

Readme

Source

Logo

NGX Electron Bridge

Custom bridge library for Electron & Angular applications

Report Bug . Request Feature


licence npm version


About The Project

Isolated context bridge library for Electron & Angular applications.

Getting Started

This project work with Electron application that are powered by Angular. We suggest using Nx Electron for this purpose.

Installation

npm install ngx-electron-bridge

Usage

  1. Expose you desired context - [main process - preload script]
    import { ContextBridgeService } from 'ngx-electron-bridge';

    const ContextBridgeService = new ContextBridgeService()
      .addIpcBridge("myExposedFunctionSignature", "my-exposed-function")
      .addIpcBridge("anotherExposedFunctionSignature", "another-exposed-function")
      .expose();
  1. Handle IPC call (in case of IPC execution) - [main process]
    import { ipcMain } from 'electron';

    ipcMain.handle("my-exposed-function", (event, ...args) => {
        console.log(args);
    });
  1. Invoke the exposed context - [renderer process]
import { Component, Inject } from '@angular/core';
import { ElectronBridge } from 'ngx-electron-bridge';

@Component({...})
export class AppComponent {
  constructor(@Inject(ElectronBridge) private _electronBridge: any) {
    _electronBridge.myExposedFunctionSignature(...args);
  }
}

Default bridges

  • platform(): returns a promise of the platform name.
  • arch(): returns a promise of the system architecture.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  • If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
  • Please make sure you check your spelling and grammar.
  • Create individual PR for each suggestion.
  • Please also read through the Code Of Conduct before posting your first idea as well.

Creating A Pull Request

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

Authors

Keywords

FAQs

Last updated on 30 Mar 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc