History and Here Now Example
by geremy
HTML
HISTORY AND HERE-NOW EXAMPLE
<div id=pubnub pub-key=demo sub-key=demo></div>
<script>
// Fun stuff for JSFiddle Logging in Result Pane
var jsFiddleConsole = function() {
return({
log: function(msg) {
consoleDiv = document.getElementById('console');
para = document.createElement('p');
text = document.createTextNode(msg);
para.appendChild(text);
consoleDiv.appendChild(para);
}
});
}();
</script>
<div id='console'>
</div>
<script src=http://cdn.pubnub.com/pubnub-3.5.1.min.js ></script>
<script>
var hereNow = function() {
PUBNUB.here_now({
channel : 'hello_world',
callback : function (message) { console.log(message) }
});
}
var history = function() {
PUBNUB.history({
count : 10,
channel : 'hello_world',
callback : function (message) { console.log(message) }
});
}
</script>
<span onclick="hereNow()">Click Me for Here Now!</span>
<span onclick="history()">Click Me for History!</span>