 # order to make that object bindable. It is applied by default to every
 # instance of Batman.Object and subclasses.
 Batman.Observable = {
+  initialize: ->
+    Batman._initializeObject @
+    @_batman.observers ||= {}
+    @_batman.preventCounts ||= {}
+  
   keypath: (string) ->
     new Batman.Keypath(@, string)
   

  # You normally shouldn't call this directly. It will be invoked by `set`
  # to inform all observers for `key` that `value` has changed.
  fire: (key, value, oldValue) ->
    # Batman._initializeObject @ # allowed will call this already
    return if not @allowed key
    
    if typeof value is 'undefined'

  # Unblocks a property for firing observers. Every call to prevent
  # must have a matching call to allow.
  allow: (key) ->
    Batman.Observable.initialize.call @
    
    counts = @_batman.preventCounts
    counts[key]-- if counts[key] > 0
    @
  
  # Returns a boolean whether or not the property is currently allowed
  # to fire its observers.
  allowed: (key) ->
    Batman.Observable.initialize.call @
    !(@_batman.preventCounts?[key] > 0)
}

