<commit_before>/*
 * Created by <NAME>
 * Licensed under MPL 2.0
 */

const { panels }   = require("resource://gre/modules/Home.jsm"),
       HomeStorage = require("resource://gre/modules/HomeProvider.jsm");

const { Class }       = require("sdk/core/heritage"),
      { EventTarget } = require("sdk/event/target"),
      { Disposable }  = require("sdk/core/disposable"),
      { identify }    = require("sdk/ui/id");

const HomePanel = Class({
    implements: [
        EventTarget,
        Disposable
    ],
    initialize: function(options) {
        var eventTarget = this,
            dataStorage = HomeStorage.getStorage(identify(this));

        dataStorage.save(options.data);

        panels.register(identify(this), () => {
            return {
                title: options.title,
                layout: panels.Layout.FRAME,
                oninstall: () => {
                    emit(eventTarget, "install");
                },
                onuninstall: () => {
                    emit(eventTarget, "uninstall");
                },
                views: [
                    {
                        type: options.type,
                        dataset: identify(this),
                        onrefresh: () => {
                            emit(eventTarget, "refresh");
                        }
                        // TODO optional view attributes
                    }
                    //TODO allow multiple views?
                ]
            }
        });
    },
    dispose: () => {
        panels.uninstall(identify(this));
        panels.unregister(identify(this));
    }        
});

exports.View = panels.View;
exports.HomePanel = HomePanel;
<commit_msg>Some methods<commit_after>/*
 * Created by <NAME>
 * Licensed under MPL 2.0
 */

const { panels }   = require("resource://gre/modules/Home.jsm"),
       HomeStorage = require("resource://gre/modules/HomeProvider.jsm");

const { Class }              = require("sdk/core/heritage"),
      { EventTarget }        = require("sdk/event/target"),
      { emit, setListeners } = require("sdk/event/core"),
      { Disposable }         = require("sdk/core/disposable"),
      { identify }           = require("sdk/ui/id");

const HomePanel = Class({
    implements: [
        EventTarget,
        Disposable
    ],
    initialize: function(options) {
        var eventTarget = this,
            dataStorage = HomeStorage.getStorage(identify(this));

        dataStorage.save(options.data);

        panels.register(identify(this), () => {
            return {
                title: options.title,
                layout: panels.Layout.FRAME,
                oninstall: () => {
                    emit(eventTarget, "install");
                },
                onuninstall: () => {
                    emit(eventTarget, "uninstall");
                },
                views: [
                    {
                        type: options.type,
                        dataset: identify(this),
                        onrefresh: () => {
                            emit(eventTarget, "refresh");
                        }
                        // TODO optional view attributes
                    }
                    //TODO allow multiple views?
                ]
            }
        });
        setListeners(this, options);

        panels.install(identify(this));
    },
    dispose: () => {
        this.clear();
        panels.uninstall(identify(this));
        panels.unregister(identify(this));
    },
    setData: (data, overwrite) => {
        var dataStorage = HomeStorage.getStorage(idenfity(this));
        return dataStorage.save(data, overwrite);
    },
    clear: () => {
        var dataStorage = HomeStorage.getStorage(idenfity(this));
        return dataStorage.deleteAll();
    } 
});

exports.View = panels.View;
exports.HomePanel = HomePanel;

{'fraction_non_alphanumeric': 0.12847132104853362, 'fraction_numerical': 0.0010381520892810796, 'mean_word_length': 1.436156763590392, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '3049387', 'n_tokens_mistral': 1007, 'n_tokens_neox': 968, 'n_words': 165}