{"size": 1080, "ext": "js", "max_stars_repo_path": "dristhi-app/assets/js/form_context.js", "max_stars_repo_name": "onaio/dristhi-app", "max_stars_repo_stars_event_min_datetime": "2015-03-05T15:44:41.000Z", "max_stars_repo_stars_event_max_datetime": "2017-11-23T06:37:17.000Z", "max_issues_repo_path": "dristhi-app/assets/js/form_context.js", "max_issues_repo_name": "onaio/dristhi-app", "max_issues_repo_issues_event_min_datetime": "2015-02-24T21:39:46.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-21T05:20:37.000Z", "max_forks_repo_path": "opensrp-enketo/src/main/assets/js/form_context.js", "max_forks_repo_name": "OpenSRP/opensrp-client-enketo", "max_forks_repo_forks_event_min_datetime": "2015-04-01T10:13:25.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-25T14:38:59.000Z"}
{"max_stars_count": 20, "max_issues_count": 514, "max_forks_count": 40, "avg_line_length": 37.2413793103, "max_line_length": 134, "alphanum_fraction": 0.6157407407}
/* globals window, alert */

function FormBridge() {
    var formContext = window.formContext;
    if (typeof formContext === "undefined" && typeof FakeFormContext !== "undefined") {
        formContext = new FakeFormContext();
    }

    return {
        delegateToFormLaunchView: function (formName, entityId, metaData) {
            return formContext.startFormActivity(formName, entityId, metaData);
        },
        delegateToMicroFormLaunchView: function (formName, entityId, metaData) {
            return formContext.startMicroFormActivity(formName, entityId, metaData);
        }
    };
}

function FakeFormContext() {
    return {
        startFormActivity: function (formName, entityId, metaData) {
            alert("Launching form: " + formName + ", for entityId: '" + entityId + "'" + ", with metaData: '" + metaData + "'");
        },
        startMicroFormActivity: function (formName, entityId, metaData) {
            alert("Launching micro form: " + formName + ", for entityId: '" + entityId + "'" + ", with metaData: '" + metaData + "'");
        }
    };
}
