Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
CoffeeScript Unchained!
CoffeeScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples use @
markem.conf use @
.gitignore
Makefile use @
README.md
package.json
unchained.coffee add unchainv
unchained.js add unchainv

README.md

coffee-unchained

unchained.coffee

Problem

There are just too many chains in the JavaScript world.

too fancy for CoffeeScript !

# jquery
$(document.createElement 'div')
  .appendTo('body')
  .css(
    width: 100
    height: 50
  )
  .text('haha')


# d3
circle = d3.select('svg').selectAll("circle")
    .data(data)
circle.enter()
    .append("circle")
    .attr("r", 2.5)
circle
    .attr("cx", (d)-> d.x)
    .attr("cy", (d)-> d.y)
circle.exit().remove()

this is more CoffeeScript!

# jquery
unchain $, (document.createElement div), ->
  @$ @appendTo, 'body', ->
    @css
      width: 100
      height: 50
    @text 'haha'

# d3
unchain d3.select, 'svg', ->
  @$ @selectAll, 'circle', ->
    @$ @data, data, ->
      @$ @enter, ->
        @$ @append, circle, ->
          @attr r: 2.5
      @attr
        cx: (d)-> d.x
        cy: (d)-> d.y
      @$ @exit, ->
        @remove()

Usage

Development

Something went wrong with that request. Please try again.