Last active
August 29, 2015 14:06
-
-
Save jeffposnick/2c4a4427091aa5d9cf4a to your computer and use it in GitHub Desktop.
Demonstrates using `unresolved` on a wrapper element, and putting a "Loading..." indicator outside of that.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Polymer Demo</title> | |
<style> | |
.hidden { | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<p id="spinner">Loading...</p> | |
<script src="//www.polymer-project.org/platform.js"></script> | |
<link rel="import" href="//www.polymer-project.org/components/polymer/polymer.html"> | |
<polymer-element name="slow-poke"> | |
<template> | |
<h1><content></content></h1> | |
</template> | |
<script> | |
Polymer({ | |
// Used to introduce a delay in initializing the Polymer element. | |
// Don't try this at home! | |
created: function() { | |
var start = Date.now(); | |
while (true) { | |
if (Date.now() - start > 1000) { | |
break; | |
} | |
} | |
} | |
}); | |
</script> | |
</polymer-element> | |
<div unresolved> | |
<slow-poke>Here I am... finally!</slow-poke> | |
<slow-poke>Me too!</slow-poke> | |
</div> | |
<script> | |
window.addEventListener('polymer-ready', function() { | |
document.querySelector('#spinner').classList.add('hidden'); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment