Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding doco and npm stuff

  • Loading branch information...
commit 988ae2f114676d0b77bfa8337a7cb8e3f1aed3d1 1 parent 985e468
Aaron Powell aaronpowell authored
2  .npmignore
... ... @@ -0,0 +1,2 @@
  1 +.git*
  2 +test/
BIN  assets/Logo.png
20 package.json
... ... @@ -0,0 +1,20 @@
  1 +{
  2 + "name": "postman",
  3 + "version": "0.1.0",
  4 + "description": "The Postman will help deliver messages around your application",
  5 + "keywords": ["pub/sub", "eventing", "message-bus"],
  6 + "author" : "Aaron Powell http://apowell.me",
  7 + "contributers" : [
  8 + "Aaron Powell http://apowell.me"
  9 + ],
  10 + "licenses": [{"type": "MIT"}],
  11 + "repositories": [{
  12 + "type": "git",
  13 + "url": "git://github.com/aaronpowell/Postman.git"
  14 + }],
  15 + "engines": ["node"],
  16 + "main" : "./lib/index.js",
  17 + "directories" : {
  18 + "lib" : "./lib"
  19 + }
  20 +}
84 readme.md
Source Rendered
... ... @@ -0,0 +1,84 @@
  1 +![Postman](https://github.com/aaronpowell/postman/raw/master/assets/logo.png)
  2 +
  3 +## What is it?
  4 +
  5 +Postman is a little JavaScript library (well it's actually [Coffeescript][1] but the Cakefile handles a build for me) which is similar to a traditional pub/ sub library, just a whole lot smarter.
  6 +
  7 +Postman *does* do pub/ sub, but it does it as a message bus, meaning that the order of handler subscription and message publishing isn't important.
  8 +
  9 +It also has no dependencies on external projects so you can drop in the unminified or the minified version and get cracking!
  10 +
  11 +## Why?
  12 +
  13 +I decided to write Postman because I wanted a way which I could have a simple message bus in JavaScript so when I subscribed to messages I could get ones sent in the past.
  14 +
  15 +## Getting Postman
  16 +
  17 +### For web
  18 +
  19 +If you want to use Postman in a website then you can grab the [development][2] or [production (a whopping 1kb!)][3] and include it.
  20 +
  21 +### For Node.js
  22 +
  23 +Postman support Node.js as well, and you can get it through [npm][4]:
  24 +
  25 + npm install postman
  26 +
  27 +Then in your Node app:
  28 +
  29 + var postman = require('postman');
  30 +
  31 +## Using Postman
  32 +
  33 +If you want to send a message with Postman then you need to have them do a delivery:
  34 +
  35 + postman.deliver('some-message', [arg1, arg2, argN]);
  36 +
  37 +To then subscribe to the messages you need to tell the Postman what you want to receive:
  38 +
  39 + postman.receive('some-message', function() { /* handle callback here */ });
  40 +
  41 +### Handling history
  42 +
  43 +Sometimes you don't care about the past so if that's the case you can subscribe and tell it to ignore history:
  44 +
  45 + postman.receive('some-message', function() { /* handle callback here */ }, true);
  46 +
  47 +And for better memory management you can kill history:
  48 +
  49 + postman.dropMessages('some-message');
  50 +
  51 +Or for more powerfull history management you can:
  52 +
  53 +* Drop messages older than a certain date
  54 +* Drop messages based on an array filter method
  55 +
  56 +## Version
  57 +0.1.0
  58 +
  59 +## License
  60 +
  61 +The MIT License
  62 +
  63 +Copyright (c) 2011 Aaron Powell
  64 +
  65 +Permission is hereby granted, free of charge, to any person obtaining a copy
  66 +of this software and associated documentation files (the "Software"), to deal
  67 +in the Software without restriction, including without limitation the rights
  68 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  69 +copies of the Software, and to permit persons to whom the Software is
  70 +furnished to do so, subject to the following conditions:
  71 +
  72 +The above copyright notice and this permission notice shall be included in
  73 +all copies or substantial portions of the Software.
  74 +
  75 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  76 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  77 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  78 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  79 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  80 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  81 +THE SOFTWARE.
  82 +
  83 +
  84 + [1]: http://coffeescript.org

0 comments on commit 988ae2f

Please sign in to comment.
Something went wrong with that request. Please try again.