Kernel-Announcements.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. smalltalk.addPackage('Kernel-Announcements', {});
  2. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  3. smalltalk.addMethod(
  4. unescape('_announcementClass'),
  5. smalltalk.method({
  6. selector: unescape('announcementClass'),
  7. category: 'accessing',
  8. fn: function (){
  9. var self=this;
  10. return self['@announcementClass'];
  11. return self;},
  12. args: [],
  13. source: unescape('announcementClass%0A%09%5EannouncementClass'),
  14. messageSends: [],
  15. referencedClasses: []
  16. }),
  17. smalltalk.AnnouncementSubscription);
  18. smalltalk.addMethod(
  19. unescape('_announcementClass_'),
  20. smalltalk.method({
  21. selector: unescape('announcementClass%3A'),
  22. category: 'accessing',
  23. fn: function (aClass){
  24. var self=this;
  25. (self['@announcementClass']=aClass);
  26. return self;},
  27. args: ["aClass"],
  28. source: unescape('announcementClass%3A%20aClass%0A%09announcementClass%20%3A%3D%20aClass'),
  29. messageSends: [],
  30. referencedClasses: []
  31. }),
  32. smalltalk.AnnouncementSubscription);
  33. smalltalk.addMethod(
  34. unescape('_block'),
  35. smalltalk.method({
  36. selector: unescape('block'),
  37. category: 'accessing',
  38. fn: function (){
  39. var self=this;
  40. return self['@block'];
  41. return self;},
  42. args: [],
  43. source: unescape('block%0A%09%5Eblock'),
  44. messageSends: [],
  45. referencedClasses: []
  46. }),
  47. smalltalk.AnnouncementSubscription);
  48. smalltalk.addMethod(
  49. unescape('_block_'),
  50. smalltalk.method({
  51. selector: unescape('block%3A'),
  52. category: 'accessing',
  53. fn: function (aBlock){
  54. var self=this;
  55. (self['@block']=aBlock);
  56. return self;},
  57. args: ["aBlock"],
  58. source: unescape('block%3A%20aBlock%0A%09block%20%3A%3D%20aBlock'),
  59. messageSends: [],
  60. referencedClasses: []
  61. }),
  62. smalltalk.AnnouncementSubscription);
  63. smalltalk.addMethod(
  64. unescape('_deliver_'),
  65. smalltalk.method({
  66. selector: unescape('deliver%3A'),
  67. category: 'announcing',
  68. fn: function (anAnnouncement){
  69. var self=this;
  70. ((($receiver = smalltalk.send(self, "_handlesAnnouncement_", [anAnnouncement])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_block", []), "_value_", [anAnnouncement]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(smalltalk.send(self, "_block", []), "_value_", [anAnnouncement]);})]));
  71. return self;},
  72. args: ["anAnnouncement"],
  73. source: unescape('deliver%3A%20anAnnouncement%0A%09%28self%20handlesAnnouncement%3A%20anAnnouncement%29%0A%09%09ifTrue%3A%20%5Bself%20block%20value%3A%20anAnnouncement%5D'),
  74. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "block"],
  75. referencedClasses: []
  76. }),
  77. smalltalk.AnnouncementSubscription);
  78. smalltalk.addMethod(
  79. unescape('_handlesAnnouncement_'),
  80. smalltalk.method({
  81. selector: unescape('handlesAnnouncement%3A'),
  82. category: 'announcing',
  83. fn: function (anAnnouncement){
  84. var self=this;
  85. return smalltalk.send(anAnnouncement, "_isKindOf_", [smalltalk.send(self, "_announcementClass", [])]);
  86. return self;},
  87. args: ["anAnnouncement"],
  88. source: unescape('handlesAnnouncement%3A%20anAnnouncement%0A%09%5EanAnnouncement%20isKindOf%3A%20self%20announcementClass'),
  89. messageSends: ["isKindOf:", "announcementClass"],
  90. referencedClasses: []
  91. }),
  92. smalltalk.AnnouncementSubscription);
  93. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  94. smalltalk.addMethod(
  95. unescape('_announce_'),
  96. smalltalk.method({
  97. selector: unescape('announce%3A'),
  98. category: 'announcing',
  99. fn: function (anAnnouncement){
  100. var self=this;
  101. smalltalk.send(self['@subscriptions'], "_do_", [(function(each){return smalltalk.send(each, "_deliver_", [anAnnouncement]);})]);
  102. return self;},
  103. args: ["anAnnouncement"],
  104. source: unescape('announce%3A%20anAnnouncement%0A%09subscriptions%20do%3A%20%5B%3Aeach%20%7C%0A%09%09each%20deliver%3A%20anAnnouncement%5D'),
  105. messageSends: ["do:", "deliver:"],
  106. referencedClasses: []
  107. }),
  108. smalltalk.Announcer);
  109. smalltalk.addMethod(
  110. unescape('_initialize'),
  111. smalltalk.method({
  112. selector: unescape('initialize'),
  113. category: 'initialization',
  114. fn: function (){
  115. var self=this;
  116. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  117. (self['@subscriptions']=smalltalk.send((smalltalk.Array || Array), "_new", []));
  118. return self;},
  119. args: [],
  120. source: unescape('initialize%0A%09super%20initialize.%0A%09subscriptions%20%3A%3D%20Array%20new'),
  121. messageSends: ["initialize", "new"],
  122. referencedClasses: ["Array"]
  123. }),
  124. smalltalk.Announcer);
  125. smalltalk.addMethod(
  126. unescape('_on_do_'),
  127. smalltalk.method({
  128. selector: unescape('on%3Ado%3A'),
  129. category: 'subscribing',
  130. fn: function (aClass, aBlock){
  131. var self=this;
  132. smalltalk.send(self['@subscriptions'], "_add_", [(function($rec){smalltalk.send($rec, "_block_", [aBlock]);smalltalk.send($rec, "_announcementClass_", [aClass]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription), "_new", []))]);
  133. return self;},
  134. args: ["aClass", "aBlock"],
  135. source: unescape('on%3A%20aClass%20do%3A%20aBlock%0A%09subscriptions%20add%3A%20%28AnnouncementSubscription%20new%0A%09%09block%3A%20aBlock%3B%0A%09%09announcementClass%3A%20aClass%3B%0A%09%09yourself%29'),
  136. messageSends: ["add:", "block:", "announcementClass:", "yourself", "new"],
  137. referencedClasses: ["AnnouncementSubscription"]
  138. }),
  139. smalltalk.Announcer);