Skip to content

A simple, reusable Javascript implementation of the observable pattern

Notifications You must be signed in to change notification settings

andrueandersoncs/Observable.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Observable.js

A simple, reusable Javascript implementation of the observable pattern

Usage

import Observable from 'observable';

const observable = new Observable();

const importantEventHandler = { date, title } => {
  // handle message
  console.log(`Remember to prepare for ${title} on ${date}!`);
};

observable.on('importantEvent', importantEventHandler);

observable.emit('importantEvent', { date: new Date(), title: 'ObserverCon' });

observable.off('importantEvent', importantEventHandler);

About

A simple, reusable Javascript implementation of the observable pattern

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published