JSFiddle - React, Tailwind, and code Playground
by basarat
HTML
<style>
html, body {
width: 100%;
height: 100%;
font-family:'Lucida Console';
background: #575757;
color: white;
margin: 0px;
overflow-y: hidden;
}
#console {
width: 95%;
height:90%;
padding: 10px;
overflow-y: auto;
}
#console div {
margin-top: 5px;
}
</style>
<div id="console"></div>
<script>
var panel = document.querySelector("#console");
var print = function(m) {
var newline = document.createElement("div");
newline.innerHTML = "> " + JSON.stringify(m);
this.panel.appendChild(newline);
};
</script>
JavaScript
var adder = {
increment: 1,
add: function (value) {
return this.increment + value;
}
}
var oldAdd = adder.add;
adder.add = function(value){
print('someone is calling with value: ' + value);
return oldAdd.apply(adder,arguments);
}
// Intercepted!
adder.add(3);