JSFiddle - React, Tailwind, and code Playground

by rodneyrehm

HTML

<script src="http://medialize.github.com/jQuery-store/preview/json2.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
<script src="http://medialize.github.com/jQuery-store/preview/jquery.store.js"></script>

JavaScript

(function($,undefined){
            
  // initialize storage API
  $.storage = new $.store();

  // build some demo interface
  var $buttons;

  var log = function(m) {
    $('<p>'+ m +'</p>').insertAfter($buttons);
  }

  var poll = function() {
    log($.storage.get('event'));
  }

  var push = function() {
    $.storage.set('event', new Date());
  }

  $(function() {
    $buttons = $('<div></div>').prependTo($(document.body));

    $('<button type="button">start writing</button>').appendTo($buttons).bind('click', function() {
      window.setInterval( push, 500 );
    });

    $('<button type="button">start reading</button>').appendTo($buttons).bind('click', function() {
      window.setInterval( poll, 1000 );
    });    
  });

})(jQuery);