查看Blaze软件包的MeteorJS代码,我注意到此视图类正下方有一个公共方法为_render
返回null。这个目的是什么?
Blaze.View = function (name, render) {
if (! (this instanceof Blaze.View))
// called without `new`
return new Blaze.View(name, render);
if (typeof name === 'function') {
// omitted "name" argument
render = name;
name = '';
}
this.name = name;
this._render = render;
this._callbacks = {
created: null,
rendered: null,
destroyed: null
};
然后就在它下面:
Blaze.View.prototype._render = function () { return null; };