Molecule icon indicating copy to clipboard operation
Molecule copied to clipboard

Add announcers to know when a Molecule Component is started and stopped

Open Eliott-Guevel opened this issue 10 months ago • 3 comments

A GitHub search of its repository shows that no such option exists at the moment: announcer

Announcers would be useful for the visualization option currently developed in Molecule-Incubator

Eliott-Guevel avatar Mar 26 '24 13:03 Eliott-Guevel

Hi @Eliott-Guevel, this code is the internal mecanism of Molecule to be notified when classes change. This is not related to component life-cycle but related to live-coding features.

I think we don't have Molecule Announcers and it should be good to propose that for monitoring a Molecule system. This can be for example:

  • ComponentInitialize
  • ComponentActivate
  • ComponentPassivate
  • ComponentRemove

labordep avatar Mar 26 '24 14:03 labordep

We have this:

MolHomeServices>>instantiateComponent: aComponentClass named: aName
(...)
      component triggerEvent: #instantiateComponent with: component.
(...)

MolHomeServices>>activateComponent: aComponentClass named: aName
(...)
      component triggerEvent: #activateComponent with: component.
(...)

etc.

This is an old mecanism, probably not used because no tests and no references to it. @ELePors I thinks we can replace this old (and not used) mecanism by new system Announcers, what is your opinion?

labordep avatar Mar 26 '24 14:03 labordep

Hi @labordep and @Eliott-Guevel

Whe should try to create Announcement subclasses :

MolComponentAbastractAnnoucement
├── MolComponentActivated
├── MolComponentInstanciated
├── ...

with a #component: method implemented to indicate which component is related to the announcement.

The MolComponentManager should do announcements... and others should listen to these announcements...

ELePors avatar Apr 06 '24 16:04 ELePors