From 425ccc5afd91bd56526a329d71d81962d25828ea Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Tue, 18 Feb 2014 21:55:53 -0800 Subject: [PATCH] Update README.md Starting examples --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41fb259..b51ba1a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,61 @@ -event-pubsub +Event PubSub ============ -Event Pubsub for Javascript will work in node js or browser +Pubsub events for Node and the browser allowing event scoping and multiple scopes. +Easy for any developer level. No frills, just high speed pubsub events! + +--- +### Basic Examples +--- +#### Node + + var events = new require('../../event-pubsub.js')(); + + events.on( + 'hello', + function(data){ + console.log('hello event recieved ', data); + } + ); + + events.on( + '*', + function(type){ + console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments); + } + ); + + /************************************\ + * trigger events for testing + * **********************************/ + events.trigger( + 'hello', + 'world' + ); + +#### Browser +##### HTML + + var events = new require('../../event-pubsub.js')(); + + events.on( + 'hello', + function(data){ + console.log('hello event recieved ', data); + } + ); + + events.on( + '*', + function(type){ + console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments); + } + ); + + /************************************\ + * trigger events for testing + * **********************************/ + events.trigger( + 'hello', + 'world' + );