-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
declare module "junk-bucket" { | ||
/** | ||
* An adapter from the standard (error, result) NodeJS callback style. | ||
* | ||
* At this point you should probably prefer to use the builtin node promises for the callbacks. Still useful for | ||
* wrapping external libraries who do not yet have callbacks. | ||
* | ||
* @callback wrap Accepts a callback to interpret the success/callback of the NodeJS style | ||
* @returns a promise to be resolved when the callback passed to perform function resolves. | ||
*/ | ||
export function es6_node<T>(wrap: (err: any, value: T) => void): Promise<T>; | ||
|
||
/** | ||
* nope - does nothing. literally. | ||
*/ | ||
export function nope(): void; | ||
|
||
interface Logger { | ||
log(...args: any[]): void; | ||
|
||
error(...args: any[]): void; | ||
} | ||
|
||
/** | ||
* Wraps the given operation and logs failures of the promise. This is primarily intended to provide async entry points | ||
* to avoid having to re-write the this for every command | ||
* | ||
* @param perform An async function to be resolved or logged | ||
* @param logger Logger to be passed to the performer and target when the application fails | ||
*/ | ||
function main(perform: (logger: Logger) => Promise<any>, logger ?: Logger); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters