pulsar/HTML/document.coffee
2011-08-22 21:24:11 -07:00

26 lines
433 B
CoffeeScript

# Fires these events:
# - opened
# - saved
# - created
class Document
path: null
text: null
listeners: []
constructor: (@path, @text) ->
name: ->
_.last @path.split '/' if @path
save: ->
trigger 'saved'
open = ->
trigger 'opened'
on: (message, listener) ->
@listeners.push listener
trigger: (message, args...) ->
_.each @listeners, (listener) ->
listener.call args...