mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-03-29 12:20:25 +00:00
23 lines
No EOL
767 B
JavaScript
23 lines
No EOL
767 B
JavaScript
module.exports = function ( target, searchChannel, statChannel ) {
|
|
target.bus = {
|
|
subscriptions : [
|
|
searchChannel.subscribe( "search.init", target.init ).withContext( target ),
|
|
searchChannel.subscribe( "newTweets", target.processNewTweets ).withContext( target ),
|
|
statChannel.subscribe( target.namespace + ".getLatest",
|
|
function ( data, env ) {
|
|
console.log( "GET LATEST FOR: " + target.namespace );
|
|
statChannel.publish( {
|
|
topic : target.namespace,
|
|
data : target.lastStats,
|
|
correlationId : env.correlationId
|
|
} )
|
|
} ).withContext( target )
|
|
],
|
|
publishers : [
|
|
target.on( target.namespace, function ( data ) {
|
|
statChannel.publish( { topic : target.namespace, data : data } );
|
|
} )
|
|
]
|
|
};
|
|
return target;
|
|
}; |