Sha256: 206563e535af8600dc0975e3c68fe471a08fb9ebda013e4665ba7f9ef3ca04ed
Contents?: true
Size: 851 Bytes
Versions: 1
Compression:
Stored size: 851 Bytes
Contents
class NSNotification def [](key) userInfo[key] end end class NSString def post_notification(object=nil, user_info=nil) if user_info and not user_info.is_a? Hash raise TypeError("Invalid argument #{user_info.class.name} sent to String.post_notification") end if user_info NSNotificationCenter.defaultCenter.postNotificationName(self, object:object, userInfo:user_info) else NSNotificationCenter.defaultCenter.postNotificationName(self, object:object) end end def add_observer(target, action, object=nil) NSNotificationCenter.defaultCenter.addObserver(target, selector: action, name: self, object: object) end def remove_observer(target, object=nil) NSNotificationCenter.defaultCenter.removeObserver(target, name:self, object:object) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-0.20.19 | lib/sugarcube/notifications.rb |