Wynn Netherland changelog.com/posts

SpacePen - Markaby-inspired CoffeeScript view framework for jQuery

SpacePen from Nathan Sobo is a Markaby-inspired, CoffeeScript-powered DSL and view framework for jQuery. SpacePen combines view and controller into a single class:

class Spacecraft extends View
  @content: ->
    @div =>
      @h1 "Spacecraft"
      @ol =>
        @li "Apollo"
        @li "Soyuz"
        @li "Space Shuttle"


...

view = new Spacecraft
view.find('ol').append('<li>Star Destroyer</li>')

view.on 'click', 'li', ->
  alert "They clicked on #{$(this).text()}"

Check out the source on GitHub for more.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00