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
| function delegate(element, eventName, selector, handler) { | |
| var el = null; | |
| element.addEventListener(eventName, function delegatedListener(e) { | |
| el = e.target; | |
| while (el !== element && el.parentNode) { | |
| if (el.nodeType === 1 && selectorMatches(el, selector)) { | |
| handler(e, el); | |
| break; | |
| } |
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
| /** | |
| * Returns download time from server | |
| * | |
| * @param {number} cwnd - Initial Congestion Window size | |
| * @param {number} rtt - Roundtrip Time in Milliseconds | |
| * @param {number} packetSize - Packet Size in Bytes | |
| * @param {number} totalSize - Total Transfer Size in Bytes | |
| * @return {number} time - Download Time in Milliseconds | |
| */ | |
| function downloadTime(cwnd, rtt, packetSize, totalSize) { |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
NewerOlder