UNPKG

md2

Version:

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Chips(Tags), Collapse, Colorpicker, Data Table, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.

35 lines 1.36 kB
import { getMdScrollStrategyAlreadyAttachedError } from './scroll-strategy'; /** * Strategy that will update the element position as the user is scrolling. */ var RepositionScrollStrategy = (function () { function RepositionScrollStrategy(_scrollDispatcher, _config) { this._scrollDispatcher = _scrollDispatcher; this._config = _config; this._scrollSubscription = null; } RepositionScrollStrategy.prototype.attach = function (overlayRef) { if (this._overlayRef) { throw getMdScrollStrategyAlreadyAttachedError(); } this._overlayRef = overlayRef; }; RepositionScrollStrategy.prototype.enable = function () { var _this = this; if (!this._scrollSubscription) { var throttle = this._config ? this._config.scrollThrottle : 0; this._scrollSubscription = this._scrollDispatcher.scrolled(throttle, function () { _this._overlayRef.updatePosition(); }); } }; RepositionScrollStrategy.prototype.disable = function () { if (this._scrollSubscription) { this._scrollSubscription.unsubscribe(); this._scrollSubscription = null; } }; return RepositionScrollStrategy; }()); export { RepositionScrollStrategy }; //# sourceMappingURL=reposition-scroll-strategy.js.map