src/Server/js/caliban.js
/**
         * Applies the given methods in the given order if they are present in cbn.
         *
         * @param {Array} cbn
         * @param {Array} methodsToApply an array containing method names in the order that they should be applied
         *                 eg ['setPropertyId', 'setTrackerUrl']
         * @returns {Array} the modified cbn array with the methods that were already applied set to undefined
         */
Applies the given methods in the given order if they are present in cbn.
@param {Array} cbn
@param {Array} methodsToApply an array containing method names in the order that they should be applied
eg ['setPropertyId', 'setTrackerUrl']
@returns {Array} the modified cbn array with the methods that were already applied set to undefined
Applies the given methods in the given order if they are present in cbn . @param { Array } cbn @param { Array } methodsToApply an array containing method names in the order that they should be applied eg [ ' setPropertyId ' ' setTrackerUrl ' ] @returns { Array } the modified cbn array with the methods that were already applied set to undefined
function applyMethodsInOrder(cbn, methodsToApply) {
            var appliedMethods = {};
            var index, iterator;
            for (index = 0; index < methodsToApply.length; index++) {
                var methodNameToApply = methodsToApply[index];
                appliedMethods[methodNameToApply] = 1;
                for (iterator = 0; iterator < cbn.length; iterator++) {
                    if (cbn[iterator] && cbn[iterator][0]) {
                        var methodName = cbn[iterator][0];
                        if (methodNameToApply === methodName) {
                            apply(cbn[iterator]);
                            delete cbn[iterator];
                            if (appliedMethods[methodName] > 1) {
                                console.warn(
                                    'The method ' +
                                        methodName +
                                        ' is registered more than once in "_cbn" variable. Only the last call has an effect. Please have a look at the multiple Caliban trackers documentation: https://developer.caliban.org/guides/tracking-javascript-guide#multiple-caliban-trackers'
                                );
                            }
                            appliedMethods[methodName]++;
                        }
                    }
                }
            }
            return cbn;
        }
function applyMethodsInOrder ( cbn , methodsToApply ) { var appliedMethods = { } ; var index , iterator ; for ( index = 0 ; index < methodsToApply . length ; index ++ ) { var methodNameToApply = methodsToApply [ index ] ; appliedMethods [ methodNameToApply ] = 1 ; for ( iterator = 0 ; iterator < cbn . length ; iterator ++ ) { if ( cbn [ iterator ] && cbn [ iterator ] [ 0 ] ) { var methodName = cbn [ iterator ] [ 0 ] ; if ( methodNameToApply === methodName ) { apply ( cbn [ iterator ] ) ; delete cbn [ iterator ] ; if ( appliedMethods [ methodName ] > 1 ) { console . warn ( 'The method ' + methodName + ' is registered more than once in "_cbn" variable. Only the last call has an effect. Please have a look at the multiple Caliban trackers documentation: https://developer.caliban.org/guides/tracking-javascript-guide#multiple-caliban-trackers' ) ; } appliedMethods [ methodName ] ++ ; } } } } return cbn ; }
Applies the given methods in the given order if they are present in cbn.
Applies the given methods in the given order if they are present in cbn .