# cordova-plugin-electron-events

> A cordova plugin for the electron platform to hook into electron lifecycle events.

Latest version **2.0.0** (published 2022-08-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-electron-events
pnpm add cordova-plugin-electron-events
yarn add cordova-plugin-electron-events
bun add cordova-plugin-electron-events
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-08-01 |
| First published | 2022-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Manoj Chandrashekar |
| Maintainers | manojchandrashekar |
| Keywords | ecosystem:cordova, cordova-electron, electron, events, hooks, cordova-plugin |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-electron-events
- Repository: https://github.com/manojchandrashekar/cordova-plugin-electron-events
- Homepage: https://github.com/manojchandrashekar/cordova-plugin-electron-events#readme
- Issues: https://github.com/manojchandrashekar/cordova-plugin-electron-events/issues
- npm.io page: https://npm.io/package/cordova-plugin-electron-events

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2022-08-01
- 1.0.0 — 2022-07-30

## README

# cordova-plugin-electron-events

A cordova plugin for the electron platform to hook into electron lifecycle events.

Supports listening to events emitted by `app` object without having to edit electron platform files.

## Features

Supported events: https://www.electronjs.org/docs/latest/api/app#events (Check according to the version of electronjs used in your project)

Requires `cordova-electron >= 2.0.0`.

## Installation

```
$ npm install cordova-plugin-electron-events
```

## Usage

Create a `settings.json` file in the project for electron (as described [here](https://cordova.apache.org/docs/en/11.x/guide/platforms/electron/index.html#customizing-the-application's-window-options)) with additional parameter `electronEvents`:

```javascript
"electronEvents": [
  {
    "event": "<event-name>",
    "script": "<src/to/script.js>" // Relative to project root
  }
]
```

Example:

```javascript
{
  "browserWindow": {
    "width": 1280,
    "height": 800
  },
  "electronEvents": [
    {
      "event": "web-contents-created",
      "script": "scripts/web-contents-created.js"
    }
  ]
}
```

Each script should contain a default exported javascript function that matches the signature of the respective electron event handler.

For instance, to modify the user agent of the `BrowserWindow` instance, the script may look like:

```javascript
module.exports = function (event, webContents) {
  // Set custom user agent.
  webContents.setUserAgent("Custom User Agent v1.4.7");
};
```

## Issues

Create a [GitHub issue](https://github.com/manojchandrashekar/cordova-plugin-electron-events/issues/new).

---
_Source: https://npm.io/package/cordova-plugin-electron-events · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
