Skip to content

Instantly share code, notes, and snippets.

@tdegrunt
Created January 5, 2012 16:56
Show Gist options
  • Save tdegrunt/1566117 to your computer and use it in GitHub Desktop.
Save tdegrunt/1566117 to your computer and use it in GitHub Desktop.
Working Canvastest for Batman
<!DOCTYPE html>
<html>
<head>
<title>Canvastest</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../lib/es5-shim.js"></script>
<script type="text/javascript" src="../lib/batman.js"></script>
<script type="text/javascript" src="../lib/batman.solo.js"></script>
<script type="text/javascript" src="../lib/coffee-script.js"></script>
</head>
<body>
<div id="container">
<h1>Canvastest</h1>
<div data-view="CanvasView"></div>
</div>
<script type="text/coffeescript">
# Create our application and namespace.
class Canvastest extends Batman.App
@global yes
# setup our root route.
@root 'app#index'
@on 'ready', ->
console.log "Canvastest ready"
class Canvastest.CanvasView extends Batman.View
html: '<canvas width="175" height="175" style="background: #ff0000"></canvas>'
render: ->
node = $(@get('node'))
node.html(@get('html'))
super
class Canvastest.AppController extends Batman.Controller
emptyTodo: null
index: ->
console.log "index action"
@render false
# Start the app.
Canvastest.run()
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment