<commit_before>'use strict';

var getPicture = function (options) {
    MeteorCamera.getPicture(options, function (error, photo) {
        if (error) {
            console.error('error', error);
        }
        if (photo) {
            Session.set('cameraSnap', photo);
        }
    });
};

Template.cameraMDG.onCreated(function () {
    Session.setDefault('cameraSnap', null);
});

Template.cameraMDG.onRendered(function () {
    Session.set('cameraSnap', null);
});

Template.cameraMDG.events({
    'click #camera-event': function () {
        getPicture({
            width: 350,
            height: 350,
            quality: 75
        });
    },
    'click #library-event': function () {
        if (Meteor.isCordova) {
            getPicture({
                width: 350,
                height: 350,
                quality: 75,
                sourceType: Camera.PictureSourceType.PHOTOLIBRARY
            });
        } else {
            console.error('Cordova only feature.');
        }
    },
    'click .retake.photo.button': function (event) {
        event.preventDefault();

        Session.set('cameraSnap', null);
    },
    'click .accept.photo.button': function (event, template) {
        event.preventDefault();

        var snapData = Session.get('cameraSnap');

        Session.set('acceptedPhoto', snapData);
    }
});

Template.cameraMDG.helpers({
    image: function () {
        return Session.get('cameraSnap');
    }
});
<commit_msg>some mods to camera module events<commit_after>'use strict';

var getPicture = function (options) {
    MeteorCamera.getPicture(options, function (error, photo) {
        if (error) {
            console.error('error', error);
        }
        if (photo) {
            Session.set('cameraSnap', photo);
        }
    });
};

Template.cameraMDG.onCreated(function () {
    Session.setDefault('cameraSnap', null);
});

Template.cameraMDG.onRendered(function () {
    Session.set('cameraSnap', null);
});

Template.cameraMDG.events({
    'click #camera-event': function (event) {
        event.preventDefault();

        getPicture({
            width: 350,
            height: 350,
            quality: 75
        });
    },
    'click #library-event': function (event) {
        event.preventDefault();

        if (Meteor.isCordova) {
            getPicture({
                width: 350,
                height: 350,
                quality: 75,
                sourceType: Camera.PictureSourceType.PHOTOLIBRARY
            });
        } else {
            console.error('Cordova only feature.');
        }
    },
    'click .retake.photo.button': function (event) {
        event.preventDefault();

        Session.set('cameraSnap', null);
    },
    'click .accept.photo.button': function (event) {
        event.preventDefault();

        var snapData = Session.get('cameraSnap');

        Session.set('acceptedPhoto', snapData);
    }
});

Template.cameraMDG.helpers({
    image: function () {
        return Session.get('cameraSnap');
    }
});

{'fraction_non_alphanumeric': 0.14157824933687002, 'fraction_numerical': 0.010610079575596816, 'mean_word_length': 2.0019900497512437, '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': '3514795', 'n_tokens_mistral': 911, 'n_tokens_neox': 858, 'n_words': 160}