UNPKG

carbon-react

Version:

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

2 lines (1 loc) 1.17 kB
import{getWindow as e}from"../../../__internal__/dom/globals.js";function n(e,n,s){return n in e?Object.defineProperty(e,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[n]=s,e}class s{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(){n(this,"components",void 0),n(this,"originalValues",void 0);const s=e();if(!s)return this.components={},void(this.originalValues=[]);s.__CARBON_INTERNALS_SCROLL_BLOCKERS||(s.__CARBON_INTERNALS_SCROLL_BLOCKERS={components:{},originalValues:[],restoreValues:null}),this.components=s.__CARBON_INTERNALS_SCROLL_BLOCKERS.components,this.originalValues=s.__CARBON_INTERNALS_SCROLL_BLOCKERS.originalValues}}export{s as default};