<commit_before>const { ipcMain } = require('electron');
const windowManager = require('../ui/window_manager');

class NativeNotificationProvider {
    constructor() {
        this.callbacks = new Map();
        ipcMain.on('__displayNotificationCallback', (event, callback_info) => {
            callback = this.callbacks.get(callback_info.id);
            callback();
            this.callbacks.delete(callback_info.id);
        });
        this.currentId = 1;
    }

    displayNotification(notification, callback) {
        notification.id = this.currentId;
        this.callbacks.set(this.currentId, callback);
        windowManager.notifyWindow('__displayNotification', notification);
        this.currentId += 1;
    }
}

module.exports = NativeNotificationProvider;<commit_msg>Fix null callback for native notifications. Closes #103.<commit_after>const { ipcMain } = require('electron');
const windowManager = require('../ui/window_manager');

class NativeNotificationProvider {
    constructor() {
        this.callbacks = new Map();
        ipcMain.on('__displayNotificationCallback', (event, callback_info) => {
            const callback = this.callbacks.get(callback_info);
            callback();
            this.callbacks.delete(callback_info);
        });
        this.currentId = 1;
    }

    displayNotification(notification, callback) {
        notification.id = this.currentId;
        this.callbacks.set(this.currentId, callback);
        windowManager.notifyWindow('__displayNotification', notification);
        this.currentId += 1;
    }
}

module.exports = NativeNotificationProvider;
{'fraction_non_alphanumeric': 0.11870727159726538, 'fraction_numerical': 0.00435052827843381, 'mean_word_length': 3.1176470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3505854', 'n_tokens_mistral': 425, 'n_tokens_neox': 412, 'n_words': 73}