JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q53880F
  • License ISC

Implementation of firebase cloud messaging based on promises

Package Exports

  • promise-fcm

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promise-fcm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

promise-fcm

An implementation of firebase cloud messaging using promises.

Documentation

Installation npm install promise-fcm --save

Function chaining You can more easily chain functions and call now to send the message. Example :

let sender = new FCM('serverKey');
let message = {
    key: value
};
let registrationDeviceId = 'registrationDeviceId'
sender
    .sendTo(registrationDeviceId)
    .withMessage(message)
    .now()
    .then(function (response) {
      console.log('Request succeeded with status ', response.statusCode);
      console.log('The response is : ' , response.body);
    })
    .catch(function (err) {
     console.log(err)
    });

Usage example

let sender = new FCM('serverKey');
let message = {
    to: registrationDeviceId,
    data: {}
}
sender.send(message)
      .then(function (response) {
        console.log('Request succeeded with status ', response.statusCode);
        console.log('The response is : ' , response.body);
      })
      .catch(function (err) {
          console.log(err)
      });

Changelog

  • 1.1.0 :
    • Added new methodology , function chaining. Consider use it.
    • send method will print as well the new message about the function chaining methodology.
    • Methods sendTo withMessage withNotification withCollapseKey and now will return inerrarray of errors is exist.

TODO'S

  • Add tests
  • Add retry case
  • Add more docs