Created
April 23, 2011 22:33
-
-
Save stagas/939047 to your computer and use it in GitHub Desktop.
dquery
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
var dnode = require('dnode') | |
, express = require('express') | |
, app = express.createServer() | |
app.use(express.static(__dirname)) | |
app.listen(8080) | |
console.log('http://localhost:8080/') | |
var server = dnode(function(remote, conn) { | |
this.click = function() { | |
var $ = remote.$ | |
$(function() { | |
$('body').append('world.') | |
}.toString()) | |
} | |
}) | |
server.listen(app, function(remote, conn) { | |
var $ = remote.$ | |
$(function() { | |
$('body').append('Hello, ') | |
}.toString()) | |
}) |
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
<html> | |
<head> | |
<script src="/dnode.js" type="text/javascript"></script> | |
<script src="/jquery.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(function() { | |
var exec = function(s) { | |
eval('(' + s + ')()') | |
} | |
DNode({ | |
$: exec | |
}).connect(function($$) { | |
$('body').click(function() { | |
$$.click() | |
}) | |
}) | |
}) | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment