Skip to content

Instantly share code, notes, and snippets.

@matkl
Created February 26, 2013 05:17
Show Gist options
  • Save matkl/5036103 to your computer and use it in GitHub Desktop.
Save matkl/5036103 to your computer and use it in GitHub Desktop.
A requirejs template using socket.io and knockout.js
requirejs.config({
paths: {
'socket.io': '/socket.io/socket.io',
'knockout': 'http://cdnjs.cloudflare.com/ajax/libs/knockout/2.2.0/knockout-min'
},
shim: {
'socket.io': {
exports: 'io'
}
}
});
require(['socket.io', 'knockout', 'viewmodel', 'domReady!', function(io, ko, vm) {
ko.applyBindings(vm);
}]);
<!DOCTYPE html>
<html>
<head>
<script data-main='/javascripts/app' src='/javascripts/require.js'></script>
</head>
<body>
Hello world.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment