Created
October 18, 2022 16:53
-
-
Save fadyosman/9dfd46510f0a18c46b8a1fbf6dec7834 to your computer and use it in GitHub Desktop.
Sample for Javascript video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>JS monitor function demo</title> | |
<script src="main.js"></script> | |
</head> | |
<body> | |
<button onclick="add(1,2);">Call Add</button><br/> | |
<button onclick='makeRequest({"name":"test","url":"https://www.google.com/"});'>Call makeRequest</button><br /> | |
<button onclick="first()">Read location.hash</button> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add(x, y) { | |
return x+y; | |
} | |
function makeRequest(y) { | |
return true; | |
} | |
function first() { | |
second(); | |
} | |
function second() { | |
var x = window.location.hash; | |
if(x.startsWith("#Render:")) { | |
var html = decodeURI(x.substring(8)); | |
document.body.innerHTML = html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment