Skip to content

A simple event observer with vanilla JavaScript for the event communication of different JavaScript Layers. Maybe it is helpful for a MVC software architecture.

Notifications You must be signed in to change notification settings

jKelio/eventobserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Observer

A simple event observer with vanilla JavaScript for the event communication of different JavaScript Layers. Maybe it is helpful for a MVC software architecture.

Installation

npm install mypluralize --save

Usage

Javascript

var EventObserver = require('EventObserver');
var eventObserver = new EventObserver();
eventObserver.subscribe(() => {
    console.log('do some stuff');
});
eventObserver.emit();
Output should be 'do some stuff'

TypeScript

import { EventObserver } from 'EventObserver';
var eventObserver: EventObserver = new EventObserver();
eventObserver.subscribe(() => {
    console.log('do some stuff');
});
eventObserver.emit();
Output should be 'do some stuff'

AMD

define(function(require,exports,module){
  var pluralise = require('mypluralize');
});

Usage for browser or any other (non CJS) environment

You can just use your favorite CJS bundler. If you have no favorite yet? Maybe you can try: Browserify or Webpack

Test

npm run test

About

A simple event observer with vanilla JavaScript for the event communication of different JavaScript Layers. Maybe it is helpful for a MVC software architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published