Skip to content

Commit

Permalink
fix: improve lifecycle deprecated message
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 18, 2024
1 parent 7a4f340 commit 00cf4c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/egg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export class EggCore extends KoaApplication {
* @param {string} [name] scope name, default is empty string
*/
beforeStart(scope: Fun, name?: string) {
this.deprecate('Please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');
this.deprecate('`beforeStart` was deprecated, please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');

Check warning on line 236 in src/egg.ts

View check run for this annotation

Codecov / codecov/patch

src/egg.ts#L236

Added line #L236 was not covered by tests
this.lifecycle.registerBeforeStart(scope, name ?? '');
}

Expand Down Expand Up @@ -276,7 +276,7 @@ export class EggCore extends KoaApplication {
* mysql.ready(done);
*/
readyCallback(name: string, opts: object) {
this.deprecate('Please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');
this.deprecate('`readyCallback` was deprecated, please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');

Check warning on line 279 in src/egg.ts

View check run for this annotation

Codecov / codecov/patch

src/egg.ts#L279

Added line #L279 was not covered by tests
return this.lifecycle.legacyReadyCallback(name, opts);
}

Expand All @@ -293,7 +293,7 @@ export class EggCore extends KoaApplication {
* @param {Function} fn - the function that can be generator function or async function.
*/
beforeClose(fn: Fun) {
this.deprecate('Please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');
this.deprecate('`beforeClose` was deprecated, please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');

Check warning on line 296 in src/egg.ts

View check run for this annotation

Codecov / codecov/patch

src/egg.ts#L296

Added line #L296 was not covered by tests
this.lifecycle.registerBeforeClose(fn);
}

Expand Down

0 comments on commit 00cf4c7

Please sign in to comment.