hkirat/notification-logger

Remove duplication of code...

lookfirst opened this issue · 1 comments

You talk about it only being ~100 lines of code, but you duplicated the code for one of the main functions, which just increases the number of lines quite a bit...

You can probably remove all that by re-using the same function... talking about this one (and what is in genericLogger())...

function log(body, title) {
        title = title || "Notification";
        if (!("Notification" in window)) {
            alert("This browser does not support desktop notification");
        } else if (Notification.permission === "granted") {
            new Notification(title ,{body: body});
        } else if (Notification.permission !== 'denied') {
            Notification.requestPermission(function (permission) {
                if (permission === "granted") {
                    new Notification(title ,{body: body});
                }
        });
      }
    }

Fixed in pull request #4