| | |
| | | var _this = _super.call(this) || this; |
| | | _this.children = {}; |
| | | // Path to this node as Array: ['usr', 'bin', 'node']. |
| | | _this.steps = []; |
| | | _this._steps = []; |
| | | // "i-node" number of the node. |
| | | _this.ino = 0; |
| | | // Number of children. |
| | | _this.length = 0; |
| | | _this.vol = vol; |
| | | _this.parent = parent; |
| | | _this.steps = parent ? parent.steps.concat([name]) : [name]; |
| | | _this.name = name; |
| | | _this.syncSteps(); |
| | | return _this; |
| | | } |
| | | Object.defineProperty(Link.prototype, "steps", { |
| | | get: function () { |
| | | return this._steps; |
| | | }, |
| | | // Recursively sync children steps, e.g. in case of dir rename |
| | | set: function (val) { |
| | | this._steps = val; |
| | | for (var _i = 0, _a = Object.values(this.children); _i < _a.length; _i++) { |
| | | var child = _a[_i]; |
| | | child === null || child === void 0 ? void 0 : child.syncSteps(); |
| | | } |
| | | }, |
| | | enumerable: false, |
| | | configurable: true |
| | | }); |
| | | Link.prototype.setNode = function (node) { |
| | | this.node = node; |
| | | this.ino = node.ino; |
| | |
| | | children: Object.keys(this.children), |
| | | }; |
| | | }; |
| | | Link.prototype.syncSteps = function () { |
| | | this.steps = this.parent ? this.parent.steps.concat([this.name]) : [this.name]; |
| | | }; |
| | | return Link; |
| | | }(events_1.EventEmitter)); |
| | | exports.Link = Link; |