Skip to main content

EventDispatcherBase

                            
                              
                                abstract 
                                class 
                                EventDispatcherBase
                                
                                  
                                    
                                      TValue
                                    
                                    
                                      THandler
                                       extends 
                                      EventHandler
                                      
                                        
                                          
                                            TValue
                                          
                                        
                                      
                                       = 
                                      EventHandler
                                      
                                        
                                          
                                            TValue
                                          
                                        
                                      
                                    
                                  
                                
                              
                              

A base for dispatching Subscribable s.

Type Parameters

  • TValue

    The type of the argument passed to subscribers.

  • THandler extends EventHandler TValue = EventHandler TValue

    The type of the callback function.

Extended by

  • AsyncEventDispatcher
  • EventDispatcher
  • FlagDispatcher
  • ValueDispatcher

Constructors

constructor

                            
                              
                                public 
                                new
                                EventDispatcherBase
                                
                                  
                                    
                                      TValue
                                    
                                    
                                      THandler
                                       extends 
                                      EventHandler
                                      
                                        
                                          
                                            TValue
                                          
                                          
                                            THandler
                                          
                                        
                                      
                                       = 
                                      EventHandler
                                      
                                        
                                          
                                            TValue
                                          
                                        
                                      
                                    
                                  
                                
                                (): 
                                EventDispatcherBase
                                
                                  
                                    
                                      TValue
                                    
                                    
                                      THandler
                                    
                                  
                                
                              
                              

Type Parameters

  • TValue
  • THandler extends EventHandler TValue THandler = EventHandler TValue

Properties

subscribable

                            
                              
                                readonly 
                                public 
                                subscribable
                                : 
                                Subscribable
                                
                                  
                                    
                                      TValue
                                    
                                    
                                      THandler
                                    
                                  
                                
                                 = 
                                ...
                              
                              

Methods

clear

                            
                              
                                public 
                                clear
                                (): 
                                void
                              
                              

Unsubscribe all subscribers from the event.


subscribe

                            
                              
                                public 
                                subscribe
                                
                                  
                                    
                                      handler
                                      : 
                                      THandler
                                    
                                  
                                
                                : () => 
                                void
                              
                              

Subscribe to the event.

Parameters

  • handler : THandler

    The handler to invoke when the event occurs.


unsubscribe

                            
                              
                                public 
                                unsubscribe
                                
                                  
                                    
                                      handler
                                      : 
                                      THandler
                                    
                                  
                                
                                : 
                                void
                              
                              

Unsubscribe from the event.

Parameters

  • handler : THandler

    The handler to unsubscribe.