Last active
June 15, 2018 06:00
-
-
Save gaurigshankar/e7a576cab4a00b400676ef1522a341bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title></title> | |
| <script> | |
| var w; | |
| if(typeof(Worker) !== "undefined") { | |
| if(typeof(w) == "undefined") { | |
| w = new Worker("../webWorker.js"); | |
| } | |
| w.onmessage = function(event) { | |
| document.getElementById("result").innerHTML = event.data; | |
| }; | |
| } else { | |
| document.getElementById("result").innerHTML = "Sorry! No Web Worker support."; | |
| } | |
| if ( document.addEventListener ) { | |
| document.addEventListener("DOMContentLoaded", function(event) { | |
| console.log("Hi DOMContentLoaded") | |
| var entries = JSON.parse(JSON.stringify(performance.getEntries())); | |
| w.postMessage({ | |
| topic: "gauri", | |
| htmlEvent: "DOMContentLoaded", | |
| content: entries | |
| }); | |
| }); | |
| window.addEventListener("load", function(event) { | |
| console.log("Hi DOMContentLoaded") | |
| var entries = JSON.parse(JSON.stringify(performance.getEntries())); | |
| w.postMessage({ | |
| topic: "gauri", | |
| htmlEvent: "onLoad", | |
| content: entries | |
| }); | |
| }); | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <div id="result"></div> | |
| </body> | |
| </html> |
This file contains hidden or 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
| this.onmessage = function (msg) { | |
| console.log(msg.data) | |
| var encodedPayload=encodeURIComponent(JSON.stringify(msg.data)); | |
| //var url = "https://beacon.walmart.com/rum.gif?perfData="+encodedPayload+"&ts=1528846772150&pv_id=testPixelTracking&a=aValue&ctx=someContext&rp=someReport&callSequenceNumber=4"; | |
| var url = "https://beacon.walmart.com/rum.gif?perfData=dummyData&ts=1528846772150&pv_id=testPixelTracking&a=aValue&ctx=someContext&rp=someReport&callSequenceNumber=4"; | |
| var xmlhttp = new XMLHttpRequest(); | |
| xmlhttp.open("GET", url, true); | |
| xmlhttp.send(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment