office-ui-fabric-react
Version: 
Reusable React components for building experiences for Office 365.
33 lines (31 loc) • 1.48 kB
JavaScript
define(["require", "exports", "tslib", "../../Utilities"], function (require, exports, tslib_1, Utilities_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var BaseDecorator = (function (_super) {
        tslib_1.__extends(BaseDecorator, _super);
        function BaseDecorator() {
            var _this = _super.call(this) || this;
            _this._shouldUpdateComponentRef = false;
            _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this);
            return _this;
        }
        /**
         * Updates the ref to the component composed by the decorator, which will also take care of hoisting
         * (and unhoisting as appropriate) methods from said component.
         *
         * Pass this method as the argument to the 'ref' property of the composed component.
         */
        BaseDecorator.prototype._updateComposedComponentRef = function (composedComponentInstance) {
            this._composedComponentInstance = composedComponentInstance;
            if (composedComponentInstance) {
                this._hoisted = Utilities_1.hoistMethods(this, composedComponentInstance);
            }
            else if (this._hoisted) {
                Utilities_1.unhoistMethods(this, this._hoisted);
            }
        };
        return BaseDecorator;
    }(Utilities_1.BaseComponent));
    exports.BaseDecorator = BaseDecorator;
});
//# sourceMappingURL=BaseDecorator.js.map