Permalink
Browse files

Add button click to demo

  • Loading branch information...
1 parent 616e5a6 commit d334fcd8fd10faaebe85d809c94c2ad394744ba3 @probins probins committed Dec 18, 2013
Showing with 17 additions and 8 deletions.
  1. +17 −8 demo/index.html
View
@@ -26,13 +26,20 @@
[a, b] = [1, 2];
console.log(a); // 1
</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>
@@ -48,10 +55,12 @@
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.