forked from moscajs/ascoltatori
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the content of index.js to lib/ascoltatori.js. Added docs to so…
…me classes. The classes doxxed are: AbstractAscoltatore, MemoryAscolatore, ascoltatori and SubsCounter. References moscajs#19.
- Loading branch information
Showing
6 changed files
with
213 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,2 @@ | ||
|
||
var SubsCounter = require("./lib/subs_counter"); | ||
var util = require("./lib/util"); | ||
var MemoryAscoltatore = require('./lib/memory_ascoltatore'); | ||
|
||
module.exports.use = function use(ascoltatore) { | ||
["publish", "subscribe", "unsubscribe", "close", "on", | ||
"removeListener", "registerDomain"].forEach(function(f) { | ||
|
||
module.exports[f] = ascoltatore[f].bind(ascoltatore); | ||
}); | ||
|
||
util.aliasAscoltatore(this); | ||
|
||
return this; | ||
}; | ||
|
||
module.exports.use(new MemoryAscoltatore()); | ||
|
||
module.exports.MemoryAscoltatore = MemoryAscoltatore; | ||
module.exports.RedisAscoltatore = require("./lib/redis_ascoltatore"); | ||
module.exports.ZeromqAscoltatore = require("./lib/zeromq_ascoltatore"); | ||
module.exports.AMQPAscoltatore = require("./lib/amqp_ascoltatore"); | ||
module.exports.MQTTAscoltatore= require("./lib/mqtt_ascoltatore"); | ||
module.exports.SubsCounter = SubsCounter; | ||
module.exports.util = util; | ||
module.exports = require("./lib/ascoltatori"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
var SubsCounter = require("./subs_counter"); | ||
var util = require("./util"); | ||
|
||
/** | ||
* You can require any Ascolatore through this module. | ||
* | ||
* @api public | ||
*/ | ||
module.exports.MemoryAscoltatore = require('./memory_ascoltatore'); | ||
module.exports.RedisAscoltatore = require("./redis_ascoltatore"); | ||
module.exports.ZeromqAscoltatore = require("./zeromq_ascoltatore"); | ||
module.exports.AMQPAscoltatore = require("./amqp_ascoltatore"); | ||
module.exports.MQTTAscoltatore= require("./mqtt_ascoltatore"); | ||
|
||
/** | ||
* Use an Ascoltatore as a global pub/sub broker inside | ||
* the current node process. | ||
* Everyone requiring ascoltatori can use it. | ||
* | ||
* @param {AbstractAscoltatore} ascoltatore the Ascoltatore to use | ||
* @return {Object} the `ascoltatori` module | ||
* @api public | ||
*/ | ||
module.exports.use = function use(ascoltatore) { | ||
["publish", "subscribe", "unsubscribe", "close", "on", | ||
"removeListener", "registerDomain"].forEach(function(f) { | ||
|
||
module.exports[f] = ascoltatore[f].bind(ascoltatore); | ||
}); | ||
|
||
util.aliasAscoltatore(this); | ||
|
||
return this; | ||
}; | ||
|
||
/** | ||
* The default global Ascoltatore is a MemoryAscoltatore. | ||
* | ||
* @api public | ||
*/ | ||
module.exports.use(new module.exports.MemoryAscoltatore()); | ||
|
||
/** | ||
* These are just utilities | ||
* | ||
* @api private | ||
*/ | ||
module.exports.SubsCounter = SubsCounter; | ||
module.exports.util = util; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters