diff --git a/packages/devextreme/js/__internal/.eslintrc.js b/packages/devextreme/js/__internal/.eslintrc.js index 433e1d5cd23e..efe56453c09f 100644 --- a/packages/devextreme/js/__internal/.eslintrc.js +++ b/packages/devextreme/js/__internal/.eslintrc.js @@ -8,6 +8,7 @@ module.exports = { plugins: [ 'simple-import-sort', ], + ignorePatterns: ['core/utils/m_view_port.ts'], overrides: [ // General TS rules. { diff --git a/packages/devextreme/js/__internal/core/utils/m_view_port.ts b/packages/devextreme/js/__internal/core/utils/m_view_port.ts index 7c21fb978506..b1389757f37b 100644 --- a/packages/devextreme/js/__internal/core/utils/m_view_port.ts +++ b/packages/devextreme/js/__internal/core/utils/m_view_port.ts @@ -6,27 +6,28 @@ const ready = readyCallbacks.add; const changeCallback = callbacks(); let $originalViewPort = $(); -const value = (function (...args) { +const value: any = (function () { let $current; - return function (element?) { - if (!args.length) { - return $current; - } - - const $element = $(element); - $originalViewPort = $element; - const isNewViewportFound = !!$element.length; - const prevViewPort = value(); - $current = isNewViewportFound ? $element : $('body'); - changeCallback.fire(isNewViewportFound ? value() : $(), prevViewPort); + return function(element) { + if(!arguments.length) { + return $current; + } + + const $element = $(element); + $originalViewPort = $element; + const isNewViewportFound = !!$element.length; + const prevViewPort = value(); + $current = isNewViewportFound ? $element : $('body'); + changeCallback.fire(isNewViewportFound ? value() : $(), prevViewPort); }; -}()); +})(); -ready(() => { +ready(function() { value('.dx-viewport'); }); + export { changeCallback, value,