<commit_before>var cameraman = null;

function CameraMan(id) {
    var _self = this;
    this.id = id;

    this.getApp = function () {
        var name = _self.id;
        return (navigator.appName.indexOf ("Microsoft") != -1 ? window : document)[name];
    };

    this.takePhoto = function () {
        _self.getApp().takePhoto();
    };
    this.sendPhoto = function () {
        _self.getApp().sendPhoto();
    };

    this._tookPhoto = function () {
        $('#' + _self.id).trigger('tookPhoto');
    };
    this._sentPhoto = function (url) {
        $('#' + _self.id).trigger('sentPhoto', url);
    };
}

cameraman = new CameraMan();<commit_msg>Create a camera using options with callbacks, not just an id<commit_after>var cameraman = null;

function CameraMan(opts) {
    var _self = this;
    this.options = opts;
    this.id = opts.id;

    this.getApp = function () {
        var name = _self.id;
        return (navigator.appName.indexOf ("Microsoft") != -1 ? window : document)[name];
    };

    this.takePhoto = function () {
        _self.getApp().takePhoto();
    };
    this.sendPhoto = function () {
        _self.getApp().sendPhoto();
    };

    this._tookPhoto = function () {
        if (_self.options.tookPhoto) {
            _self.options.tookPhoto.apply(_self);
        }
    };
    this._sentPhoto = function (url) {
        if (_self.options.sentPhoto) {
            _self.options.sentPhoto.apply(_self, url);
        }
    };
}

cameraman = new CameraMan();
{'fraction_non_alphanumeric': 0.15534633490248823, 'fraction_numerical': 0.0013449899125756557, 'mean_word_length': 2.3214285714285716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '868292', 'n_tokens_mistral': 476, 'n_tokens_neox': 466, 'n_words': 91}