File size: 778 Bytes
57e2194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="https://unpkg.com/streamlit-component-lib@2.0.0/dist/index.js"></script>
  </head>
  <body>
    <script>
      function sendBrowserTime() {
        const now = new Date().toISOString();
        Streamlit.setComponentValue(now);
        Streamlit.setFrameHeight(0);
      }

      function onRender(event) {
        const { disabled } = event.detail.args || {};
        if (!disabled) {
          sendBrowserTime();
        }
      }

      Streamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRender);
      Streamlit.setComponentReady();
      Streamlit.setFrameHeight(0);
    </script>
  </body>
</html>