Sha256: ce4cbe61fb78720e66d1c3f85a2b2f6eb0fff57212ba455629fc9a54b71f77ff

Contents?: true

Size: 526 Bytes

Versions: 17

Compression:

Stored size: 526 Bytes

Contents

class NSNotificationCenter
  def observers
    @observers ||= []
  end

  def observe(name, object=nil, &proc)
    observer = self.addObserverForName(name, object:object, queue:NSOperationQueue.mainQueue, usingBlock:proc)
    observers << observer
    observer
  end

  def unobserve(observer)
    return unless observers.include?(observer)
    removeObserver(observer)
    observers.delete(observer)
  end
  
  def post(name, object=nil, info=nil)
    self.postNotificationName(name, object: object, userInfo: info)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bubble-wrap-1.4.0 motion/core/ns_notification_center.rb
bubble-wrap-1.3.0 motion/core/ns_notification_center.rb
bubble-wrap-1.3.0.osx motion/core/ns_notification_center.rb
bubble-wrap-1.2.0 motion/core/ns_notification_center.rb
bubble-wrap-1.2.0.pre motion/core/ns_notification_center.rb
bubble-wrap-1.1.5 motion/core/ns_notification_center.rb
bubble-wrap-1.1.4 motion/core/ns_notification_center.rb
bubble-wrap-1.1.3 motion/core/ns_notification_center.rb
bubble-wrap-1.1.2 motion/core/ns_notification_center.rb
bubble-wrap-1.1.1 motion/core/ns_notification_center.rb
bubble-wrap-1.1.0 motion/core/ns_notification_center.rb
bubble-wrap-1.0.0 motion/core/ns_notification_center.rb
bubble-wrap-1.0.0.pre.2 motion/core/ns_notification_center.rb
bubble-wrap-1.0.0.pre motion/core/ns_notification_center.rb
bubble-wrap-0.4.0 motion/core/ns_notification_center.rb
bubble-wrap-0.3.1 lib/bubble-wrap/ns_notification_center.rb
bubble-wrap-0.3.0 lib/bubble-wrap/ns_notification_center.rb