Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
firstline1
titleExample
collapsetrue
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Contxtful API demo</title>

  <!-- Load the Contxtful API Javascript -->
  <script async src="//ctxtfl.com/scripts/js/m.js?id=AbCdEfGhIj1234567890"></script>
</head>

<body>
   <h1>CONTXTFUL API Demo</h1>
   <h2><pre id="output"></pre></h2>

<script>
function showContext() {
   // We catch the response from the Contxtful API
   var response = Contxtful.Api.Results;
   if (response != undefined) {
      // Print the response to screen (pretty JSON)
      document.getElementById("output").innerHTML = JSON.stringify(response, undefined, 4);
   } else {
      response = "You might be seeing this message because your device lacks physical sensors.<br>";
      response += "Feel free to right-click and select View Page Source to see how this demo uses the ";
      response += "CONTXTFUL API.";
      document.getElementById("output").innerHTML = response;
   }
}

// Refresh the data shown on screen every 0.1s
setInterval(showContext, 100);
</script>
</body>
</html>

Latency

...

and timing strategy

See this link for more information

...