JSFiddle - React, Tailwind, and code Playground

by Aubrey Taylor

JavaScript

/////////////////////////////// 
// Throw open that console!  //
///////////////////////////////

// stubbing out global Namespace
var FX = {
	Global: {
  	showModal: function(modalId) {
    	console.log("(original) FX.Global.showModal got called with " + modalId)
    }
  }
}

// instead of totally blowing it away, lets save a ref
var _fxGlobalShowModal = FX.Global.showModal;

function fxGlobalShowModalPatch(modalId) {
	if(modalId != "overlay-select-provider") {
  	return _fxGlobalShowModal(modalId);
  }
  
  // now we can do what we whatever we want...
  console.log("(patch) FXGlobalShowModalPatch got called with " + modalId);
}

// do patch
FX.Global.showModal = fxGlobalShowModalPatch

// let's try it out!
FX.Global.showModal("overlay-select-provider");
FX.Global.showModal("overlay-foobarbaz");