Codeminer42/cm42-central

View on GitHub
app/assets/javascripts/mixins/tab_notification.js

Summary

Maintainability
A
0 mins
Test Coverage
const TabNotification = {
  changeTitle: function (title, documentStatus) {
    var notificationTitle = ' \u2733 ' + title;

    if (documentStatus) {
      this.handleChangeTitle(
        notificationTitle,
        $('body').data('notificationIconUrl')
      );
    } else {
      this.handleChangeTitle(title, $('body').data('faviconIconUrl'));
    }
  },

  handleChangeTitle: function (title, href) {
    var favicon = $('link[rel="shortcut icon"]');
    favicon.prop('href', href);
    document.title = title;
  },
};

export default TabNotification;