@angular2-material/core
Version:
Angular 2 Material core
39 lines (37 loc) • 1.27 kB
JavaScript
/**
* Reference to an overlay that has been created with the Overlay service.
* Used to manipulate or dispose of said overlay.
*/
export var OverlayRef = (function () {
function OverlayRef(_portalHost, _pane, _state) {
this._portalHost = _portalHost;
this._pane = _pane;
this._state = _state;
}
OverlayRef.prototype.attach = function (portal) {
var attachResult = this._portalHost.attach(portal);
this.updatePosition();
return attachResult;
};
OverlayRef.prototype.detach = function () {
return this._portalHost.detach();
};
OverlayRef.prototype.dispose = function () {
this._portalHost.dispose();
};
OverlayRef.prototype.hasAttached = function () {
return this._portalHost.hasAttached();
};
/** Gets the current state config of the overlay. */
OverlayRef.prototype.getState = function () {
return this._state;
};
/** Updates the position of the overlay based on the position strategy. */
OverlayRef.prototype.updatePosition = function () {
if (this._state.positionStrategy) {
this._state.positionStrategy.apply(this._pane);
}
};
return OverlayRef;
}());
//# sourceMappingURL=overlay-ref.js.map