{"size": 606, "ext": "js", "max_stars_repo_path": "CopyToClipboard/src/scripts/factories/clipboardFactory.js", "max_stars_repo_name": "marlonsupetran/ChromeExtensions", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "CopyToClipboard/src/scripts/factories/clipboardFactory.js", "max_issues_repo_name": "marlonsupetran/ChromeExtensions", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "CopyToClipboard/src/scripts/factories/clipboardFactory.js", "max_forks_repo_name": "marlonsupetran/ChromeExtensions", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.3076923077, "max_line_length": 52, "alphanum_fraction": 0.498349835}
import Clipboard from 'Clipboard';

const clipboardFactory = {
    create: (selector, getText) => {
        var cb = new Clipboard(selector, {
            text: getText
        });

        cb.on('success', e => {
            console.info('Action:', e.action);
            console.info('Text:', e.text);
            // console.info('Trigger:', e.trigger);

            e.clearSelection();
        });

        cb.on('error', e => {
            console.error('Action:', e.action);
            // console.error('Trigger:', e.trigger);
        });

        return cb;
    }
}

export default clipboardFactory;