/**
* A template method that is called when your application boots. It is called before the
* {@link Ext.app.Application Application}'s launch function is executed so gives a hook point
* to run any code before your Viewport is created.
*
* @param {Ext.app.Application} application
*
* @template
*/
init: Ext.emptyFn,
/**
* A template method like {@link #init}, but called after the viewport is created.
* This is called after the {@link Ext.app.Application#launch launch} method of Application
* is executed.
*
* @param {Ext.app.Application} application
*
* @template
*/
onLaunch: Ext.emptyFn,
1条答案
按热度按时间g6ll5ycj1#
模板方法是一种可以在派生类上实现的方法,就像你想做的那样,然后自动调用。别担心,这是你会做很多事情的。
如果你看一下文件的源代码,你会发现它已经在那里了,但是它被分配了一个空函数。框架调用了这个空函数。如果你从一个有模板方法的类扩展,你可以“覆盖”那些方法。框架以一定的顺序调用这些方法。
Ext.app.Controller的一段源代码: