<commit_before>(bbn => {
  "use strict";
  bbn.fn.autoExtend("vue", {
    /**
     * Browser Notification Component.
     * @component browserNotificationComponent
     */
    browserNotificationComponent: {
      /**
       * @mixin bbn.vue.serviceWorkerComponent
       * @memberof browserNotificationComponent
       */
      mixins: [bbn.vue.serviceWorkerComponent],
      props: {
        /**
         * @prop {Boolean} [false] browserNotification
         */
        browserNotification: {
          type: Boolean,
          default: false
        }
      },
      data(){
        return {
          /**
           * @data {Boolean} [false] hasBrowserPermission
           * @memberof browserNotificationComponent
           */
          hasBrowserPermission: false,
          /**
           * @data {Object} [{}] browserNotifications
           * @memberof browserNotificationComponent
           */
          browserNotifications: {},
          /**
           * @data {String} [''] browserNotificationURL
           * @memberof browserNotificationComponent
           */
          browserNotificationURL: '',
          /**
           * @data {Boolean} [false] browserNotificationSW
           * @memberof browserNotificationComponent
           */
          browserNotificationSW: false
        }
      },
      methods: {
        /**
           * @method browserNotify
           * @memberof browserNotificationComponent
           * @param {String} title
           * @param {String} text,
           * @param {Object} options
           * @fires _postMessage
           * @fires $set
           */
        browserNotify(title, text, options){
          if (this.ready
            && this.browserNotification
            && this.hasBrowserPermission
            && title
            && text
          ) {
            if (bbn.fn.isObject(text)) {
              options = text;
            }
            else if (bbn.fn.isString(text)) {
              if (bbn.fn.isObject(options)) {
                options = {
                  body: text
                }
              }
              else {
                options = {};
              }
              if (!options.body || (options.body !== text)) {
                options.body = text;
              }
            }
            options.tag = options.tag || options.timestamp || n.timestamp;
            if (this.browserNotificationSW) {
              this._postMessage({
                type: 'notification',
                data: {
                  title: title,
                  options: options
                }
              })
            }
            else {
              options.onclick = this.browserNotificationClick;
              let n = new Notification(title, options);
              this.$set(this.browserNotifications, options.tag, n);
            }
          }
        },
        /**
         * @method browserNotificationClick
         * @memberof browserNotificationComponent
         * @param {Object} options
         * @fires post
         * @fires removeBrowserNotification
         * @fires messageToChannel
         */
        browserNotificationClick(options){
          if (this.browserNotificationURL) {
            this.post(this.browserNotificationURL + '/actions/read', {id: options.tag}, d => {
              if (d.success) {
                this.removeBrowserNotification(options.tag);
                this.messageToChannel({
                  method: 'removeBrowserNotification',<commit_msg>Fixed browserNotify method<commit_after>(bbn => {
  "use strict";
  bbn.fn.autoExtend("vue", {
    /**
     * Browser Notification Component.
     * @component browserNotificationComponent
     */
    browserNotificationComponent: {
      /**
       * @mixin bbn.vue.serviceWorkerComponent
       * @memberof browserNotificationComponent
       */
      mixins: [bbn.vue.serviceWorkerComponent],
      props: {
        /**
         * @prop {Boolean} [false] browserNotification
         */
        browserNotification: {
          type: Boolean,
          default: false
        }
      },
      data(){
        return {
          /**
           * @data {Boolean} [false] hasBrowserPermission
           * @memberof browserNotificationComponent
           */
          hasBrowserPermission: false,
          /**
           * @data {Object} [{}] browserNotifications
           * @memberof browserNotificationComponent
           */
          browserNotifications: {},
          /**
           * @data {String} [''] browserNotificationURL
           * @memberof browserNotificationComponent
           */
          browserNotificationURL: '',
          /**
           * @data {Boolean} [false] browserNotificationSW
           * @memberof browserNotificationComponent
           */
          browserNotificationSW: false
        }
      },
      methods: {
        /**
           * @method browserNotify
           * @memberof browserNotificationComponent
           * @param {String} title
           * @param {String} text,
           * @param {Object} options
           * @fires _postMessage
           * @fires $set
           */
        browserNotify(title, text, options){
          if (this.ready
            && this.browserNotification
            && this.hasBrowserPermission
            && title
            && text
          ) {
            if (bbn.fn.isObject(text)) {
              options = text;
            }
            else if (bbn.fn.isString(text)) {
              if (!bbn.fn.isObject(options)) {
                options = {};
              }
              if (!options.body || (options.body !== text)) {
                options.body = text;
              }
            }
            let date = bbn.fn.date();
            options.tag = options.tag || options.timestamp || date.getTime();
            options.timestamp = options.timestamp || date.getTime();
            if (this.browserNotificationSW) {
              this._postMessage({
                type: 'notification',
                data: {
                  title: title,
                  options: options
                }
              })
            }
            else {
              options.onclick = this.browserNotificationClick;
              let n = new Notification(title, options);
              this.$set(this.browserNotifications, options.tag, n);
            }
          }
        },
        /**
         * @method browserNotificationClick
         * @memberof browserNotificationComponent
         * @param {Object} options
         * @fires post
         * @fires removeBrowserNotification
         * @fires messageToChannel
         */
        browserNotificationClick(options){
          if (this.browserNotificationURL) {
            this.post(this.browserNotificationURL + '/actions/read', {id: options.tag}, d => {
              if (d.success) {
                this.removeBrowserNotification(options.tag);
                this.messageToChannel({
                  method: 'removeBrowserNotification',
{'fraction_non_alphanumeric': 0.10265942236202459, 'fraction_numerical': 0.0, 'mean_word_length': 1.379251700680272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7299937', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1607, 'n_words': 313}