Skip to content
This is a micro publish/subscribe event messaging framework based on MinPubSub by Daniel Lamb.
JavaScript
Find file
Pull request Compare This branch is 2 commits ahead, 14 commits behind daniellmb:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
History.md
LICENSE.txt
README.md
example.html
minpubsub.js
minpubsub.src.js
mps.js
unit-tests.htm

README.md

Overview

This is a micro publish/subscribe event messaging framework based on MinPubSub by Daniel Lamb.

This fork introduces an Event class. Events have a type (e.g., 'MyEvent'), an action (e.g., 'click'), and data (e.g., {x:1, y:2}). You can create, publish, subscribe, and unsubscribe to events. Everything is encapsulated into a single global varibale named mps. That's all there is to it.

Usage

// We Create events using the Event constructor
var event = new mps.Event('MyEvent', 'click', {x:1, y:2});

// We can also use the create function
event = mps.create('MyEvent', 'click', {x:1, y:2});

// Here's how we subscribe to events
mps.subscribe('MyEvent', function(event) {console.log(event.getData())});

// And here's how we publish events
mps.publish(event);
Something went wrong with that request. Please try again.