diff --git a/extras/README.md b/extras/README.md index 20992a5..60fc7b7 100644 --- a/extras/README.md +++ b/extras/README.md @@ -60,7 +60,7 @@ import {fromInterval} from 'sub-events/ext'; const onInterval = fromInterval(1000); // creating 1-second interval event -const sub = onInterval.subscribe((count: number) => { +const sub = onInterval.subscribe(() => { // handling the interval event }); diff --git a/extras/src/from-emitter.ts b/extras/src/from-emitter.ts index 2c6a3fd..5715047 100644 --- a/extras/src/from-emitter.ts +++ b/extras/src/from-emitter.ts @@ -2,7 +2,7 @@ import {IEmitOptions, SubEventCount} from '../../src'; import {EventEmitter} from 'events'; /** - * Creates event from emitter, for one-argument, strongly-typed events. + * Creates a named event from emitter, for one-argument, strongly-typed events. * * If your event takes multiple arguments, see fromEmitterArgs below. */ @@ -24,7 +24,7 @@ export function fromEmitter(target: EventEmitter, event: string | s } /** - * Creates event from emitter, for multi-argument, any-type events. + * Creates a named event from emitter, for multi-argument, any-type events. * * The emitted arguments are passed into the handler as an array. */ diff --git a/extras/src/from-event.ts b/extras/src/from-event.ts index a724628..ca80f54 100644 --- a/extras/src/from-event.ts +++ b/extras/src/from-event.ts @@ -1,9 +1,7 @@ import {SubEventCount, IEmitOptions} from '../../src'; /** - * Example of sharing a generic Event, based on the subscription count: - * - we call `addEventListener` whenever the first subscriber has been registered; - * - we call `removeEventListener` after the last subscription has been cancelled. + * Creates a strongly-typed, named DOM Event wrapper. */ export function fromEvent(target: EventTarget, event: string, options?: IEmitOptions): SubEventCount { const sec: SubEventCount = new SubEventCount(); diff --git a/extras/src/from-timeout.ts b/extras/src/from-timeout.ts index 1910eb4..54ac666 100644 --- a/extras/src/from-timeout.ts +++ b/extras/src/from-timeout.ts @@ -13,8 +13,7 @@ export function fromTimeout(timeout: number = 0, options?: IEmitOptions): Timeou /** * Implements timeout event, with automatically cancelled subscriptions. * - * It also illustrates the general approach to implementing events with - * self-cancel subscription logic. + * A new timeout is automatically created for every subscriber. */ export class TimeoutEvent extends SubEvent { constructor(timeout: number = 0, options?: IEmitOptions) {