lib/sugarcube/notifications.rb in sugarcube-0.8.5 vs lib/sugarcube/notifications.rb in sugarcube-0.8.6
- old
+ new
@@ -10,6 +10,17 @@
else
NSNotificationCenter.defaultCenter.postNotificationName(self, object:object)
end
end
+ def add_observer(observer, message, object=nil)
+ NSNotificationCenter.defaultCenter.addObserver(observer,
+ selector: message,
+ name: self,
+ object: object)
+ end
+
+ def remove_observer(observer, object=nil)
+ NSNotificationCenter.defaultCenter.removeObserver(observer, name:self, object:object)
+ end
+
end