Class: Subject

Subject()

This class has a collection of observers where to events are fired.

Constructor

new Subject()

Source:

Methods

addEventListener(observer)

Added an observer. It can only be added once.

Parameters:
Name Type Description
observer Observer

The observer to add

Source:

fire(event)

Send an event to all observers.

Parameters:
Name Type Description
event Event

The event

Source:

removeEventListener(observer)

Remove an observer

Parameters:
Name Type Description
observer Observer

The observer to be removed

Source: