UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

2 lines (1 loc) 1.23 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../__internal__/dom/globals.js");function s(e,s,t){return s in e?Object.defineProperty(e,s,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[s]=t,e}exports.default=class{registerComponent(e){this.components[e]=!0}unregisterComponent(e){delete this.components[e]}saveRestoreValuesCallback(e){window.__CARBON_INTERNALS_SCROLL_BLOCKERS&&(window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues=e)}getRestoreValuesCallback(){var e;return null===(e=window.__CARBON_INTERNALS_SCROLL_BLOCKERS)||void 0===e?void 0:e.restoreValues}saveOriginalValues(e){this.originalValues.length=0,this.originalValues.push(...e)}getOriginalValues(){return this.originalValues}isBlocked(){return 0!==Object.entries(this.components).length}constructor(){s(this,"components",void 0),s(this,"originalValues",void 0);const t=e.getWindow();if(!t)return this.components={},void(this.originalValues=[]);t.__CARBON_INTERNALS_SCROLL_BLOCKERS||(t.__CARBON_INTERNALS_SCROLL_BLOCKERS={components:{},originalValues:[],restoreValues:null}),this.components=t.__CARBON_INTERNALS_SCROLL_BLOCKERS.components,this.originalValues=t.__CARBON_INTERNALS_SCROLL_BLOCKERS.originalValues}};