@@ -201,7 +201,14 @@ class EggCore extends KoaApplication {
201201 }
202202
203203 /**
204- * Execute scope after loaded and before app start
204+ * Execute scope after loaded and before app start.
205+ *
206+ * Notice:
207+ * This method is now NOT recommanded and reguarded as a deprecated one,
208+ * For plugin development, we should use `didLoad` instead.
209+ * For application development, we should use `willReady` instead.
210+ *
211+ * @see https://eggjs.org/en/advanced/loader.html#beforestart
205212 *
206213 * @param {Function|GeneratorFunction|AsyncFunction } scope function will execute before app start
207214 */
@@ -249,8 +256,16 @@ class EggCore extends KoaApplication {
249256 }
250257
251258 /**
252- * Register a function that will be called when app close
253- * @param {Function } fn - the function that can be generator function or async function
259+ * Register a function that will be called when app close.
260+ *
261+ * Notice:
262+ * This method is now NOT recommanded directly used,
263+ * Developers SHOULDN'T use app.beforeClose directly now,
264+ * but in the form of class to implement beforeClose instead.
265+ *
266+ * @see https://eggjs.org/en/advanced/loader.html#beforeclose
267+ *
268+ * @param {Function } fn - the function that can be generator function or async function.
254269 */
255270 beforeClose ( fn ) {
256271 this . lifecycle . registerBeforeClose ( fn ) ;
@@ -317,13 +332,13 @@ class EggCore extends KoaApplication {
317332 * @param {Function } fn The inputted function.
318333 * @return {AsyncFunction } An async promise-based function.
319334 * @example
320- * ```javascript
321- * const fn = function* (arg) {
335+ ```javascript
336+ const fn = function* (arg) {
322337 return arg;
323338 };
324339 const wrapped = app.toAsyncFunction(fn);
325340 wrapped(true).then((value) => console.log(value));
326- * ```
341+ ```
327342 */
328343 toAsyncFunction ( fn ) {
329344 if ( ! is . generatorFunction ( fn ) ) return fn ;
@@ -338,14 +353,14 @@ class EggCore extends KoaApplication {
338353 * @param {Mixed } obj The inputted object.
339354 * @return {Promise } A Promisable result.
340355 * @example
341- * ```javascript
342- * const fn = function* (arg) {
356+ ```javascript
357+ const fn = function* (arg) {
343358 return arg;
344359 };
345360 const arr = [ fn(1), fn(2) ];
346361 const promise = app.toPromise(arr);
347362 promise.then(res => console.log(res));
348- * ```
363+ ```
349364 */
350365 toPromise ( obj ) {
351366 return co ( function * ( ) {
0 commit comments