Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Mar 15th, 2012  |  syntax: CoffeeScript  |  size: 0.48 KB  |  hits: 51  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # main.coffee
  2. $(document).ready ->
  3.   item = new Channel 'test'
  4.   item.insert
  5.  
  6. ###
  7. This class represents one channel
  8. ###
  9.  
  10. class Channel
  11.    
  12.   @updates = 0
  13.   @id = -1
  14.   @channels = $('#channels ul')
  15.  
  16.   constructor: (@name) ->
  17.  
  18.   insert: (position) ->
  19.   # insert and the element to the channel at a given position
  20.   # position: the position where it should be added
  21.     @dom_elem = $ '<li>'
  22.     @channels.add @dom_elem
  23.     $.data @dom_elem, 'id', @id