Skip to content

Commit

Permalink
More documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
KeesCBakker committed May 29, 2016
1 parent bfcbd52 commit 31aa2d0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 0 additions & 2 deletions StronglyTypesEvents-0.2.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class SimpleEventDispatcher<TArgs> extends DispatcherBase<ISimpleEventHandler<TA
{
/**
* Dispatches the event.
* @param sender The sender.
* @param args The arguments object.
*/
dispatch(args: TArgs): void {
Expand All @@ -101,7 +100,6 @@ class SimpleEventDispatcher<TArgs> extends DispatcherBase<ISimpleEventHandler<TA

/**
* Dispatches the events thread.
* @param sender The sender.
* @param args The arguments object.
*/
dispatchAsync(args: TArgs): void {
Expand Down
23 changes: 22 additions & 1 deletion typings/StronglyTypesEvents-0.2.0.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@
* Event handler function with a generic sender and a generic argument.
*/
interface IEventHandler<TSender, TArgs> {
/**
* @sender The sender.
* @args The argument.
*/
(sender: TSender, args: TArgs): void
}

/**
* Event handler function with a generic argument
*/
interface ISimpleEventHandler<TArgs> {
/**
* @args The argument.
*/
(args: TArgs): void
}

Expand All @@ -26,8 +33,14 @@ interface ISimpleEventHandler<TArgs> {
*/
interface ISubscribable<THandlerType> {

/** Subscribe to the event.
* @param fn The event handler that is called when the event is dispatched.
*/
subscribe(fn: THandlerType): void;

/** Unsubscribe from the event.
* @param fn The event handler that is will be unsubsribed from the event.
*/
unsubscribe(fn: THandlerType): void;
}

Expand All @@ -48,8 +61,16 @@ interface ISimpleEvent<TArgs> extends ISubscribable<ISimpleEventHandler<TArgs>>
*/
interface IBaseEventHandling<TEventHandler> {

/** Subscribe to the event with the specified name.
* @param name The name of the event.
* @param fn The event handler that is called when the event is dispatched.
*/
subscribe(name: string, fn: TEventHandler): void;


/** Unsubscribe from the event with the specified name.
* @param name The name of the event.
* @param fn The event handler that is will be unsubsribed from the event.
*/
unsubscribe(name: string, fn: TEventHandler): void;
}

Expand Down

0 comments on commit 31aa2d0

Please sign in to comment.