UNPKG

1.27 kBJavaScriptView Raw
1/**
2 * Reference to an overlay that has been created with the Overlay service.
3 * Used to manipulate or dispose of said overlay.
4 */
5export var OverlayRef = (function () {
6 function OverlayRef(_portalHost, _pane, _state) {
7 this._portalHost = _portalHost;
8 this._pane = _pane;
9 this._state = _state;
10 }
11 OverlayRef.prototype.attach = function (portal) {
12 var attachResult = this._portalHost.attach(portal);
13 this.updatePosition();
14 return attachResult;
15 };
16 OverlayRef.prototype.detach = function () {
17 return this._portalHost.detach();
18 };
19 OverlayRef.prototype.dispose = function () {
20 this._portalHost.dispose();
21 };
22 OverlayRef.prototype.hasAttached = function () {
23 return this._portalHost.hasAttached();
24 };
25 /** Gets the current state config of the overlay. */
26 OverlayRef.prototype.getState = function () {
27 return this._state;
28 };
29 /** Updates the position of the overlay based on the position strategy. */
30 OverlayRef.prototype.updatePosition = function () {
31 if (this._state.positionStrategy) {
32 this._state.positionStrategy.apply(this._pane);
33 }
34 };
35 return OverlayRef;
36}());
37
38//# sourceMappingURL=overlay-ref.js.map