mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/JiboOs.git
synced 2026-06-16 03:16:28 +00:00
35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
/** @isInitialized method decorator
|
|
*
|
|
* Enforces that `this.isInitialized` is true or calls the callback with an error.
|
|
* Assumes the last argument is the callback. Must appear after @promisfy decorator, if any.
|
|
* @internal
|
|
*/
|
|
|
|
/** @promisify method decorator
|
|
*
|
|
* Assumes the last argument is suppose to be a callback. If the last
|
|
* argument isn't a function, then assume the callback was left off on
|
|
* purpose and wrap the method call in a promise and return the
|
|
* promise.
|
|
*
|
|
* Note: only works with callbacks that return one result (or less) in
|
|
* addition to the err argument. e.g. callback(err), or callback(err, res),
|
|
* but not callback(err, res, res2) (because of the way promises work)
|
|
* @internal
|
|
*/
|
|
|
|
/** @promisify_n method decorator
|
|
* Takes one argument, the argument number of the callback. If that
|
|
* argument isn't a function, then assume the callback was left off on
|
|
* purpose and wrap the method call in a promise and return the
|
|
* promise. The argument number is one-based: the first argument
|
|
* number is 1 (not zero), the second argument is 2, etc.
|
|
*
|
|
* The decorator takes the argument just like a function:
|
|
* @promisify_n(2) // if the second argument is the callback
|
|
*
|
|
* Note: only works with callbacks that return one result (or less) in
|
|
* addition to the err argument. e.g. callback(err), or callback(err, res),
|
|
* but not callback(err, res, res2) (because of the way promises work)
|
|
* @internal
|
|
*/ |