How to use the enketo-core/src/js/calculate.update function in enketo-core

To help you get started, we’ve selected a few enketo-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kobotoolbox / enketo-express / public / js / src / enketo-webform-view.js View on Github external
import gui from './module/gui';
import controller from './module/controller-webform';
import settings from './module/settings';
import connection from './module/connection';
import { init as initTranslator, t, localize } from './module/translator';

const $loader = $( '.main-loader' );
const $formheader = $( '.main > .paper > .form-header' );
const survey = {
    enketoId: settings.enketoId,
    instanceId: settings.instanceId
};

// Completely disable calculations in Enketo Core
import calcModule from 'enketo-core/src/js/calculate';
calcModule.update = () => {
    console.log( 'Calculations disabled.' );
};
// Completely disable instanceID and deprecatedID population in Enketo Core
import { FormModel } from 'enketo-core/src/js/form-model';
FormModel.prototype.setInstanceIdAndDeprecatedId = () => {
    console.log( 'InstanceID and deprecatedID population disabled.' );
};
// Completely disable preload items
import preloadModule from 'enketo-core/src/js/preload';
preloadModule.init = () => {
    console.log( 'Preloaders disabled.' );
};

initTranslator( survey )
    .then( survey => connection.getFormParts( survey ) )
    .then( formParts => {