File: index.html

package info (click to toggle)
es-module-loader-0.17.js 0.17.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 548 kB
  • sloc: javascript: 2,324; makefile: 13
file content (68 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!doctype html>
<head>
  <style>
    body {
      background: blue;
      color: #fff;
    }
    pre {
      color: black;
      background: white;
    }
  </style>
</head>
<body>
  <div role="main">
    <h1>Module Loader Polyfill</h1>
    <p>Check the console in your browser developer tools! This code is currently loaded in the page:</p>
    <pre>
  &lt;script src="../node_modules/traceur/bin/traceur.js">&lt;/script>
  &lt;script src="../dist/es6-module-loader-dev.js">&lt;/script>
  &lt;script type="module">
    import { hello } from 'test1.js';
    console.log(hello); // -> world

    // es6 syntax
    var a, b;
    [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>
    function buttonClick() {
      // dynamic loading API
      System.import('test2.js').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>

  <script src="../node_modules/traceur/bin/traceur.js"></script>
  <script src="../dist/es6-module-loader-dev.js"></script>
  <script type="module">
    import { hello } from 'test1.js';
    console.log(hello); // -> world

    // es6 syntax
    var a, b;
    [a, b] = [1, 2];
    console.log(a); // -> 1
  </script>
  <script>
    function buttonClick() {
      // dynamic loading API
      System.import('test2.js').then(function(module) {
        new module.Foo();
      });
    }
  </script>
</body>
</html>