Sha256: d6e5d1d85812208cd1d1b74a30088794c8f5252f0296a97efcf3864da60ea9dc
Contents?: true
Size: 582 Bytes
Versions: 8
Compression:
Stored size: 582 Bytes
Contents
class NSNotificationCenter def observers @observers ||= [] end def observe(name, object=nil, &proc) proc.weak! if proc && BubbleWrap.use_weak_callbacks? 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
8 entries across 8 versions & 1 rubygems