mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
track attached RootComponents
This commit is contained in:
@@ -670,14 +670,33 @@ RawHtmlComponent = Component.extend({
|
||||
}
|
||||
});
|
||||
|
||||
// A RootComponent is the root of its Component tree in terms
|
||||
// of parent/child relationships. It's the only kind of
|
||||
// component that can function without actually being added
|
||||
// to another component first.
|
||||
|
||||
// @export RootComponent
|
||||
RootComponent = Component.extend({
|
||||
constructed: function () {
|
||||
// skip the UNADDED phase completely
|
||||
this.stage = Component.ADDED;
|
||||
|
||||
this._uid = Random.id();
|
||||
},
|
||||
render: function (buf) {
|
||||
var bodyClass = this.getArg('bodyClass');
|
||||
if (bodyClass)
|
||||
buf.component(bodyClass.create(), {key: 'body'});
|
||||
},
|
||||
attached: function () {
|
||||
RootComponent._attachedInstances[this._uid] = this;
|
||||
},
|
||||
detached: function () {
|
||||
delete RootComponent._attachedInstances[this._uid];
|
||||
},
|
||||
destroyed: function () {
|
||||
delete RootComponent._attachedInstances[this._uid];
|
||||
}
|
||||
});
|
||||
|
||||
RootComponent._attachedInstances = {};
|
||||
Reference in New Issue
Block a user