export function getInitialSettings()

in src/getInitialSettings.js [25:55]


export function getInitialSettings() {
    const settings = {};

    if (sessionId === null) {
        sessionId = getSessionId('userAleSessionId', 'session_' + String(Date.now()));
    }

    const script = document.currentScript || (function () {
        const scripts = document.getElementsByTagName('script');
        return scripts[scripts.length - 1];
    })();

    const get = script ? script.getAttribute.bind(script) : function () {
        return null;
    };
    settings.autostart = get('data-autostart') === 'false' ? false : true;
    settings.url = get('data-url') || 'http://localhost:8000';
    settings.transmitInterval = +get('data-interval') || 5000;
    settings.logCountThreshold = +get('data-threshold') || 5;
    settings.userId = get('data-user') || null;
    settings.version = get('data-version') || null;
    settings.logDetails = get('data-log-details') === 'true' ? true : false;
    settings.resolution = +get('data-resolution') || 500;
    settings.toolName = get('data-tool') || null;
    settings.userFromParams = get('data-user-from-params') || null;
    settings.time = timeStampScale(document.createEvent('CustomEvent'));
    settings.sessionID = get('data-session') || sessionId;
    settings.authHeader = get('data-auth') || null;
    settings.custIndex = get('data-index') || null;
    return settings;
}