JSFiddle - React, Tailwind, and code Playground

by peterbenoit

HTML

<a onClick="OmnitureCall.handler('reportA')" href="#">Report A</a>
<a onClick="OmnitureCall.handler('reportB')" href="#">Report B</a>

JavaScript

window.OmnitureCall = {
    handler: function(callback) {
        //console.log('something is called',typeof(this[callback]));
        if(typeof(this[callback]) === "function") {
            this[callback]();
        }
    },
    reportA: function() {
        console.log('reportA fired');
    },
    reportB: function() {
        console.log('reportB fired');
    }

};