1.0.2 • Published 6 years ago

react-observer-pattern v1.0.2

Weekly downloads
7
License
ISC
Repository
github
Last release
6 years ago

react-observer-pattern

A Node.js module that implement the observer pattern in react

Installation

npm install react-observer-pattern --save

Usage

TypeScript

import { Observer, IObserver } from 'react-observer-pattern';

export class test implements IObserver {

  ReceiveNotification(message: any): void {
    console.log(message);
  }

  constructor(){
    Observer.GetGlobalInstance().RegisterObserver("key", this);
  }
}
Observer.GetGlobalInstance().NotifyObservers("key", "message");

This sample show you :

  • How to bind to a specific key
  • How to send an information to a specific key