Last active
August 29, 2015 13:56
-
-
Save pellekrogholt/9092401 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|announcerInstance announcerInstanceDoInitialize point1 point2 announcer1 announcer2| | |
Transcript clear. | |
announcerInstanceDoInitialize := false. | |
announcerInstance := FilteringAnnouncer current. | |
announcerInstanceDoInitialize ifTrue: [announcerInstance initialize]. | |
"announcerInstanceDoInitialize ifTrue: [announcerInstance teardown]." | |
Transcript show: 'announcerInstance subscriptions size: ', announcerInstance subscriptions size; cr. | |
announcer1 := announcerInstance on: [:e | e x == 1] do: [:announcement | | |
Transcript show: 'do something when announcement occurs'; cr. | |
]. | |
announcer2 := announcerInstance on: [:e | e y == 1] do: [:announcement | | |
Transcript show: 'do something when announcement occurs'; cr. | |
]. | |
point1 := Point new x: 1; y: 1; yourself. | |
announcerInstance announce: point1. | |
point2 := Point new x: 1; y: 2; yourself. | |
announcerInstance announce: point2. | |
"we are a bit confused with the unsubscribe ?" | |
announcerInstance unsubscribe: point2. | |
Transcript show: 'announcerInstance subscriptions size: ', announcerInstance subscriptions size; cr. | |
announcerInstance off: announcer1. | |
announcerInstance off: announcer2. | |
Transcript show: 'announcerInstance subscriptions size: ', announcerInstance subscriptions size; cr. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment