• Stars
    star
    186
  • Rank 207,316 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).

electron-push-receiver

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).

Why and how ?

See this blog post.

Install

npm i -S electron-push-receiver

Usage

  • In main.js / in main process :
const { setup: setupPushReceiver } = require('electron-push-receiver');

// Call it before 'did-finish-load' with mainWindow a reference to your window
setupPushReceiver(mainWindow.webContents);
  • In renderer process :
import { ipcRenderer } from 'electron';
import {
  START_NOTIFICATION_SERVICE,
  NOTIFICATION_SERVICE_STARTED,
  NOTIFICATION_SERVICE_ERROR,
  NOTIFICATION_RECEIVED as ON_NOTIFICATION_RECEIVED,
  TOKEN_UPDATED,
} from 'electron-push-receiver/src/constants';

// Listen for service successfully started
ipcRenderer.on(NOTIFICATION_SERVICE_STARTED, (_, token) => // do something);
// Handle notification errors
ipcRenderer.on(NOTIFICATION_SERVICE_ERROR, (_, error) => // do something);
// Send FCM token to backend
ipcRenderer.on(TOKEN_UPDATED, (_, token) => // Send token);
// Display notification
ipcRenderer.on(ON_NOTIFICATION_RECEIVED, (_, notification) => // display notification);
// Start service
ipcRenderer.send(START_NOTIFICATION_SERVICE, senderId);

Example

Thanks to CydeSwype, you can find an example project here.

More Repositories

1

unused-webpack-plugin

A webpack plugin to find unused modules/source files.
JavaScript
176
star
2

push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.
JavaScript
176
star
3

remnants

Find unused files. Spot these residues, leftovers, relics of an ancient past.
JavaScript
21
star
4

open-image-feed

A open source self-hosted real-time image feed.
JavaScript
19
star
5

shelljs-plugin-ssh

A ssh plugin for shelljs
JavaScript
10
star
6

ssh2-client

A Promise based wrapper around ssh2 to exec commands or setup a live shell on a remote host.
JavaScript
6
star
7

create-pr

Open github create PR page for the given branch.
JavaScript
5
star
8

git-training

Yet another git training.
HTML
4
star
9

immersive

A framework to build immersive CLIs & great developer tools.
JavaScript
4
star
10

terminal-joystick

🎮 A joystick for your terminal.
JavaScript
3
star
11

from-and-to-json

An Atom package to convert selected JSON to Javascript object and vice versa
JavaScript
3
star
12

ionic-gulp

Gulp tasks for Ionic development
JavaScript
2
star
13

connected-house

A open source connected house.
JavaScript
2
star
14

lxcjs

A Node JS wrapper around lxc commands
JavaScript
2
star
15

autoclicker

👆 An autoclicker built with Node.js.
JavaScript
2
star
16

hacker-typer

A hacker typer using streams.
JavaScript
2
star
17

angular-material-express-seed

A Angular Material and Express seed
JavaScript
2
star
18

blessed-circle

🎨 Draw a circle in your terminal using blessed.
JavaScript
1
star
19

liner

Show a specific line from a file.
JavaScript
1
star
20

smart-home

A open source smart home powered by Raspberry Pi and Node JS
JavaScript
1
star
21

Scripts

A bunch of scripts
Shell
1
star
22

quick-actions

A macOS menubar app to execute quick actions
JavaScript
1
star
23

javascript-tooling

A Javascript tooling presentation
JavaScript
1
star
24

JunkBot

A junk but awesome bot
Python
1
star
25

vorpal-seed

A vorpal seed with storage, ssh support and sample commands
JavaScript
1
star
26

CreateFolderAndMove

Add an entry to the contextual menu under Windows when you right click on a file to create a Folder with the name of the selected file and move the file in it
Batchfile
1
star