imports/vx/client/code/vxapp.js
/**
     * Add a database-resident function to KeepTrack global object.
     *
     * @param {object} newFunction New function.
     */
Add a database-resident function to KeepTrack global object.
@param {object} newFunction New function.
Add a database - resident function to KeepTrack global object . @param { object } newFunction New function .
addFunction(newFunction) {
        try {
            const functionAnchor = VXApp.functionAnchor()
            if (!functionAnchor) {
                return
            }
            if (!newFunction.name) {
                console.log(`vxapp.js addFunction no name yet ignoring functionId=${newFunction._id}`)
                return
            }
            if (typeof newFunction.name === "string") {
                delete window[functionAnchor][newFunction.name]
            }
            if (!newFunction.value) {
                console.log(`vxapp.js addFunction no value conditionally deleting functionId=${newFunction._id}`)
                return
            }
            const func = eval(`(${newFunction.value})`)
            if (typeof newFunction.name === "string" && typeof func === "function") {
                window[functionAnchor][newFunction.name] = func
            }
        }
        catch (error) {
            OLog.error(`vxapp.js addFunction unexpected error ${error}`)
        }
    }
addFunction ( newFunction ) { try { const functionAnchor = VXApp . functionAnchor ( ) if ( ! functionAnchor ) { return } if ( ! newFunction . name ) { console . log ( ` ${ newFunction . _id } ` ) return } if ( typeof newFunction . name === "string" ) { delete window [ functionAnchor ] [ newFunction . name ] } if ( ! newFunction . value ) { console . log ( ` ${ newFunction . _id } ` ) return } const func = eval ( ` ${ newFunction . value } ` ) if ( typeof newFunction . name === "string" && typeof func === "function" ) { window [ functionAnchor ] [ newFunction . name ] = func } } catch ( error ) { OLog . error ( ` ${ error } ` ) } }
Add a database-resident function to KeepTrack global object.
Add a database - resident function to KeepTrack global object .