Adds documentations for adapters and main constructors (#4951)
* wip * Adds documentations for adapters, and constructors * nits * nit
This commit is contained in:
49
src/Adapters/PubSub/PubSubAdapter.js
Normal file
49
src/Adapters/PubSub/PubSubAdapter.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/**
|
||||
* @module Adapters
|
||||
*/
|
||||
/**
|
||||
* @interface PubSubAdapter
|
||||
*/
|
||||
export class PubSubAdapter {
|
||||
/**
|
||||
* @returns {PubSubAdapter.Publisher}
|
||||
*/
|
||||
static createPublisher() {}
|
||||
/**
|
||||
* @returns {PubSubAdapter.Subscriber}
|
||||
*/
|
||||
static createSubscriber() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface Publisher
|
||||
* @memberof PubSubAdapter
|
||||
*/
|
||||
interface Publisher {
|
||||
/**
|
||||
* @param {String} channel the channel in which to publish
|
||||
* @param {String} message the message to publish
|
||||
*/
|
||||
publish(channel: string, message: string):void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface Subscriber
|
||||
* @memberof PubSubAdapter
|
||||
*/
|
||||
interface Subscriber {
|
||||
/**
|
||||
* called when a new subscription the channel is required
|
||||
* @param {String} channel the channel to subscribe
|
||||
*/
|
||||
subscribe(channel: string): void;
|
||||
|
||||
/**
|
||||
* called when the subscription from the channel should be stopped
|
||||
* @param {String} channel
|
||||
*/
|
||||
unsubscribe(channel: string): void;
|
||||
}
|
||||
|
||||
export default PubSubAdapter;
|
||||
Reference in New Issue
Block a user