@0b5vr/experimental
    Preparing search index...

    Function notifyObservers

    • A bare function to notify observers. The incredibly cheap implementation of the observer pattern.

      Use along with the utility type definition Observer.

      Parameters

      • observers: Iterable<Observer<void>>

        The iterator of observers

      Returns void

      const observers = new Set<Observer<string>>();

      observers.add( ( text ) => console.log( text ) );
      observers.add( ( text ) => alert( text ) );

      notifyObservers( observers, 'wenis' );
    • A bare function to notify observers. The incredibly cheap implementation of the observer pattern.

      Use along with the utility type definition Observer.

      Type Parameters

      • T

      Parameters

      • observers: Iterable<Observer<T>>

        The iterator of observers

      • param: T

        The param you want to give to observers

      Returns void

      const observers = new Set<Observer<string>>();

      observers.add( ( text ) => console.log( text ) );
      observers.add( ( text ) => alert( text ) );

      notifyObservers( observers, 'wenis' );