Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update stuff that I didn't commit many months ago

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information...
commit 45f3e8aa99314ccf0405efd51725ff6e0aae8026 1 parent 69574f9
Rick Waldron authored
Showing with 60 additions and 16 deletions.
  1. +6 −7 test/index.html
  2. +9 −9 test/specit.html
  3. +45 −0 test/test.php
13 test/index.html
View
@@ -1,12 +1,11 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html>
<html>
<head>
<title>jquery.eventsource.unit</title>
- <link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="https://raw.github.com/jquery/qunit/master/qunit/qunit.css" type="text/css" media="screen" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
- <script src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
-
+ <script src="https://raw.github.com/jquery/qunit/master/qunit/qunit.js"></script>
+
<script src="../jquery.eventsource.js"></script>
<script src="jquery.eventsource.unit.js"></script>
@@ -17,7 +16,7 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
-
+
<iframe src="specit.html" style="width:100%;height:600px;border:0px;"></iframe>
-
+
</html>
18 test/specit.html
View
@@ -1,27 +1,27 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>jquery.eventsource.specit</title>
- <link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="https://raw.github.com/jquery/qunit/master/qunit/qunit.css" type="text/css" media="screen" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
- <script src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
- <script src="http://github.com/joshuaclayton/specit/raw/master/specit.js"></script>
-
+ <script src="https://raw.github.com/jquery/qunit/master/qunit/qunit.js"></script>
+ <script src="https://raw.github.com/joshuaclayton/specit/master/specit.js"></script>
+
<script src="../jquery.eventsource.js"></script>
<script src="jquery.eventsource.specit.js"></script>
-
+
<script>
-
+
$(function () {
if(top.location != location) {
-
+
$('body').css({
marginLeft: '0px',
marginTop: '0px'
});
-
+
}
});
</script>
45 test/test.php
View
@@ -0,0 +1,45 @@
+<?php
+
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
+
+if ($action == 'stream') {
+ //set event handler
+ header("Content-Type: text/event-stream");
+ header('Cache-Control: no-cache'); // recommended to prevent caching of event data.
+ ob_implicit_flush(true);
+ //ini_set('output_buffering', 'off');
+ for ($i=1;$i<50;$i++) {
+ echo 'data: ' . $i . "\n\n";
+ ob_flush();
+ flush();
+
+ sleep(1);
+ }
+ //exit();
+} else {
+?>
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>jQuery.eventsource.js</title>
+ <script src="http://code.jquery.com/jquery-latest.js"></script>
+ <script src="../jquery.eventsource.js"></script>
+ <script>
+ $(document).ready(function(){
+ $.eventsource({
+ label: "event-source-label",
+ url: "test.php?action=stream",
+ dataType: "text",
+ message: function(data) {
+ console.log( data + "<br>" );
+
+ }
+ });
+ })
+ </script>
+ </head>
+<body></body>
+</html>
+<?php
+}
Please sign in to comment.
Something went wrong with that request. Please try again.