node-prowl icon indicating copy to clipboard operation
node-prowl copied to clipboard

run in Browser - without node

Open tefod-zz opened this issue 3 years ago • 0 comments

Hi, due I needed a browser solution for sending push notifications, just ran it through browserify. I made a window function, which can be called through the HTML. Following main.js is been browserfied. Works great.

window.ProwlPush = function (
  apikey,
  content,
  header,
  priority = 0,
  description = null,
  url = null
) {
  var Prowl = require("node-prowl");
  var prowl = new Prowl(apikey);

  prowl.push(
    content,
    header,
    {
      priority: priority,
      description: description,
      url: url,
    },
    function (err, remaining) {
      if (err) throw err;
      console.log(
        "I have " + remaining + " calls to the api during current hour."
      );
    }
  );
};

But even after minifying with uglifyjs there is still a 1.3Mb file.

So, is there an easier or native JS way to send push notification per Prowl - or can we dispense for some require's, so that we can slim down a bit?

tefod-zz avatar Aug 21 '21 08:08 tefod-zz