On 25 Oct 2014, at 2:42 , Jan B. <bliznjan@fit.cvut.cz> wrote:
Hi all
Today I come with a question regarding announcements. I would like to make announcement subscription which would remove itself after first use. Something like...
anObject announcer subscribe: TRMouseDragEnd do: [ :event | self thisMethodWith: differentParameters. "anObject announcer removeSubscription: ...this one..." ].
All I was able to do is write there anObject announcer unsubscribe: self. which somehow works, but this instance could have multiple subscriptions and it would remove even those I don't want to remove, I need to remove only this specific one...
Jan
-- View this message in context: http://forum.world.st/Self-removing-announcement-subscription-tp4786622.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Modify: AnnouncementSubscription >> #deliver: " deliver an announcement to receiver. In case of failure, it will be handled in separate process" ^ (self handlesAnnouncement: anAnnouncement ) ifTrue: [ [action cull: anAnnouncement cull: announcer cull: self] on: UnhandledError fork: [:ex | ex pass ]] and you could use the block: [:event :announcer :sub | self thisMethodWith: differentParameters announcer removeSubscription: sub ] VW already does this for their announcement implementation, it might be a good idea to introduce the third parameter in stock Pharo as well. Cheers, Henry