Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
Add button click to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
probins committed Dec 18, 2013
1 parent 616e5a6 commit d334fcd
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions demo/index.html
Expand Up @@ -26,13 +26,20 @@ <h1>Module Loader Polyfill</h1>
[a, b] = [1, 2];
console.log(a); // 1
&lt;/script>
</pre>
<p>Click on the button below and this function will be run:</p>
<pre>
&lt;script>
// dynamic loading API
System.import('test2').then(function(module) {
new module.Foo(); // -> Created the ES6 class foo!
});
function buttonClick() {
// dynamic loading API
System.import('test2').then(function(module) {
new module.Foo();
});
}
&lt;/script>
</pre>
<button onclick="buttonClick()">Load test2</button>
<p>Note that if you click on the button again, a new Foo module will be created, but 'test2' will not be reloaded.</p>
</div>
<footer>
</footer>
Expand All @@ -48,10 +55,12 @@ <h1>Module Loader Polyfill</h1>
console.log(a); // -> 1
</script>
<script>
// dynamic loading API
System.import('test2').then(function(module) {
new module.Foo();
});
function buttonClick() {
// dynamic loading API
System.import('test2').then(function(module) {
new module.Foo();
});
}
</script>
</body>
</html>

0 comments on commit d334fcd

Please sign in to comment.