Skip to content

Commit

Permalink
Update type syntax in module docs; use rust module doc syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Havvy committed Sep 12, 2016
1 parent 00087ed commit f2a3489
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions after-events.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
/**
*
* Event Emitter
*
* Publisher/Subscriber Pattern implementation.
*
* Differences from Node's EventEmitter:
* .after(cb) method (see below)
* Listeners that throw errors are caught and logged to console.
* Listeners happen during their own turn.
* Listener can only listen a maximum of one time with .on()
* "removeListener" is called "off"
* No way to see if the listener is listening. (unused)
* No "addListener" alias
* No domains (unused)
* No erroring on unhandled error event. (unused)
* No maximum listener count. (unused)
* No prototype/No `new` needed to create.
*
* after(callback: function (err: Error U undefined, res: Any U undefined, type: String, ...args: Any)): undefined
* callback is ran after every listener returns.
* First parameter to the callback is the error of the listener, if there is one.
* Second parameter to the callback is the return value of the listener, if there is one.
* The rest of the parameters are the parameters sent to the .emit() that triggered the listener.
*
* If you need one of the features this lacks that is marked unused, feel free to send a pull request/file an issue.
*/
//! ## After-Events Event Emitter
//!
//! Publisher/Subscriber Pattern implementation.
//!
//! Differences from Node's EventEmitter:
//! * `.after(cb)`` method (see below)
//! * Listeners that throw errors are caught and logged to console.
//! * Listeners happen during their own turn.
//! * Listener can only listen a maximum of one time with .on()
//! * "removeListener" is called "off"
//! * No way to see if the listener is listening. (unused)
//! * No "addListener" alias
//! * No domains (unused)
//! * No erroring on unhandled error event. (unused)
//! * No maximum listener count. (unused)
//! * No prototype/No `new` needed to create.
//!
//! type Callback = Fn(Error, any, String, ...any) -> void
//!
//! AfterEventEmitter::after(callback: Callback)
//! callback is ran after every listener returns.
//! First parameter to the callback is the error of the listener, if there is one.
//! Second parameter to the callback is the return value of the listener, if there is one.
//! The rest of the parameters are the parameters sent to the .emit() that triggered the listener.
//!
//! If you need one of the features this lacks that is marked unused,
//! feel free to send a pull request/file an issue.

const Promise = require('bluebird');

const EventEmitter = function () {
// type Callback = Fn(Error, any, String, ...any) -> void
const events = new Map(); // Map<String, Set<Callback>>
var postListenerCallbacks = []; // [Callback]

Expand Down

0 comments on commit f2a3489

Please sign in to comment.