Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Aug 5, 2019
1 parent 194e91b commit 7ba619c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ export interface ISubContext<T = unknown> {
*/
export interface IEventOptions<T> {
/**
* Maximum number of subscribers that can receive data.
* Maximum number of subscribers that can receive events.
* Default is 0, meaning `no limit applies`.
*
* As the older subscriptions get cancelled, the newer ones
* outside of the maximum quota will start receiving events.
*/
maxSubs?: number;

Expand Down Expand Up @@ -146,7 +149,7 @@ export class SubEvent<T = unknown> {

/**
* Asynchronous data broadcast to all subscribers. Each subscriber will be receiving
* the event within its own processor tick (under Node.js), or timer tick (inside browsers).
* the event within its own processor tick (under Node.js), or timer tick (in browsers).
*
* @param data
* Data to be sent, according to the type template.
Expand Down Expand Up @@ -174,7 +177,7 @@ export class SubEvent<T = unknown> {

/**
* Safe asynchronous data broadcast to all subscribers. Each subscriber will be receiving
* the event within its own processor tick (under Node.js), or timer tick (inside browsers).
* the event within its own processor tick (under Node.js), or timer tick (in browsers).
*
* Errors from subscription callbacks are passed into `onError` function, to handle both
* synchronous and asynchronous subscription functions.
Expand Down Expand Up @@ -295,7 +298,7 @@ export class SubEvent<T = unknown> {
* Gets all recipients that must receive data.
*
* It returns a copy of subscribers array for safe iteration, while applying the
* maximum limit when it is set with the [[max]] option.
* maximum limit when it is set with the [[maxSubs]] option.
*
* @hidden
*/
Expand Down
2 changes: 1 addition & 1 deletion test/event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('SubEvent', () => {
sub.cancel();
expect(sub.live).to.be.false;
});
it('must limit notifications according to the max option', () => {
it('must limit notifications according to the maxSubs option', () => {
const a = new SubEvent<number>({maxSubs: 1});
const cb1 = () => 1;
const cb2 = () => 2;
Expand Down

0 comments on commit 7ba619c

Please sign in to comment.