Created
May 19, 2011 12:00
-
-
Save tommedema/980593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['/nowjs/now.js', '/lib/jquery.js'], function() { | |
console.log('woo, registration handler here I come!'); | |
//called when server gives a response to our registration request | |
now.onRegisterCallback = function(success, err) { | |
console.log('registered as user: ' + userName); | |
if (success) $('#myInfo').html('UserName: ' + userName); | |
else $('#myInfo').html('Error, cannot register: ' + err); | |
}; | |
//called when now.js communication has been setup | |
now.ready(function() { | |
console.log('now.js is connected to server: %o', now); | |
//register to the server with a username | |
userName = 'user' + new Date().getTime(); | |
now.register(userName); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment