2
0

Kernel-Announcements.deploy.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. fn: function (){
  8. var self=this;
  9. return self['@announcementClass'];
  10. return self;}
  11. }),
  12. smalltalk.AnnouncementSubscription);
  13. smalltalk.addMethod(
  14. unescape('_announcementClass_'),
  15. smalltalk.method({
  16. selector: unescape('announcementClass%3A'),
  17. fn: function (aClass){
  18. var self=this;
  19. (self['@announcementClass']=aClass);
  20. return self;}
  21. }),
  22. smalltalk.AnnouncementSubscription);
  23. smalltalk.addMethod(
  24. unescape('_block'),
  25. smalltalk.method({
  26. selector: unescape('block'),
  27. fn: function (){
  28. var self=this;
  29. return self['@block'];
  30. return self;}
  31. }),
  32. smalltalk.AnnouncementSubscription);
  33. smalltalk.addMethod(
  34. unescape('_block_'),
  35. smalltalk.method({
  36. selector: unescape('block%3A'),
  37. fn: function (aBlock){
  38. var self=this;
  39. (self['@block']=aBlock);
  40. return self;}
  41. }),
  42. smalltalk.AnnouncementSubscription);
  43. smalltalk.addMethod(
  44. unescape('_deliver_'),
  45. smalltalk.method({
  46. selector: unescape('deliver%3A'),
  47. fn: function (anAnnouncement){
  48. var self=this;
  49. ((($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]);})]));
  50. return self;}
  51. }),
  52. smalltalk.AnnouncementSubscription);
  53. smalltalk.addMethod(
  54. unescape('_handlesAnnouncement_'),
  55. smalltalk.method({
  56. selector: unescape('handlesAnnouncement%3A'),
  57. fn: function (anAnnouncement){
  58. var self=this;
  59. return smalltalk.send(anAnnouncement, "_isKindOf_", [smalltalk.send(self, "_announcementClass", [])]);
  60. return self;}
  61. }),
  62. smalltalk.AnnouncementSubscription);
  63. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  64. smalltalk.addMethod(
  65. unescape('_announce_'),
  66. smalltalk.method({
  67. selector: unescape('announce%3A'),
  68. fn: function (anAnnouncement){
  69. var self=this;
  70. smalltalk.send(self['@subscriptions'], "_do_", [(function(each){return smalltalk.send(each, "_deliver_", [anAnnouncement]);})]);
  71. return self;}
  72. }),
  73. smalltalk.Announcer);
  74. smalltalk.addMethod(
  75. unescape('_initialize'),
  76. smalltalk.method({
  77. selector: unescape('initialize'),
  78. fn: function (){
  79. var self=this;
  80. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  81. (self['@subscriptions']=smalltalk.send((smalltalk.Array || Array), "_new", []));
  82. return self;}
  83. }),
  84. smalltalk.Announcer);
  85. smalltalk.addMethod(
  86. unescape('_on_do_'),
  87. smalltalk.method({
  88. selector: unescape('on%3Ado%3A'),
  89. fn: function (aClass, aBlock){
  90. var self=this;
  91. 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", []))]);
  92. return self;}
  93. }),
  94. smalltalk.Announcer);