Created
August 30, 2018 13:53
-
-
Save picatz/670c56e6b995266ace8db3bec5db43e0 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> | |
<script src="https://cdn.rawgit.com/picatz/builderJS/8ca588fc/src/builder.js"></script> | |
</html> | |
<script> | |
// instantiate a new builder | |
var b = new Builder(); | |
// getTime() is a simple function to return the current | |
// time in the HH:MM:SS format | |
function getTime() { | |
return new Date().toLocaleString().split(", ")[1] | |
} | |
// currentTime element is an h1 HTML element that updates | |
// itself every second to show the current time using the | |
// getTime() function | |
var currentTime = b.heading({ | |
text: getTime(), | |
events: { | |
tick: function() { currentTime.innerText = getTime() } | |
} | |
}) | |
// append currentTime element to the document's body | |
b.append(currentTime) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment