Skip to content

Commit

Permalink
Improve documentation on Callback.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wwahammy committed Oct 19, 2022
1 parent 7910fe4 commit bc460c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/javascript/common/Callbacks/Callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default class Callback<T> {
}

/**
* A boolean property deciding whether .run should be called.
* A boolean method deciding whether .run should be called. By default it's true but can be overriden in subclasses.
* @returns true if this callback should be run, false if it should not.
*/
canRun(): boolean {
return true;
Expand All @@ -26,10 +27,10 @@ export default class Callback<T> {
}

/**
* Runs the callback
* Runs the callback itself. Must be implemented in a child class.
* @return a Promise<void> or void
*/
run(): Promise<void> | void {
throw new Error("You need to implement this in a child class");
throw new Error("You need to implement 'run' in your child class");
}
}

0 comments on commit bc460c6

Please sign in to comment.