Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynamic-virtual-scroller

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-virtual-scroller - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "dynamic-virtual-scroller",
"version": "1.0.2",
"version": "1.0.3",
"description": "A virtual scroller for the web that can handle dynamic row and column sizes.",

@@ -5,0 +5,0 @@ "main": "virtual-scroller.js",

@@ -1419,4 +1419,69 @@ window.VirtualScroller = (function ($, _) {

/*
Dom Cache Adapter
*/
VirtualScroller.DomCacheAdapter = function (scrollerConfig) {
/*
TODO: React to all dynamic changes like rowRemoved, rowAdded, rerender, ...
*/
var rowCache = {};
var columnCache = {};
var oldOnBeforeRowRemoved = scrollerConfig.onBeforeRowRemoved;
scrollerConfig.onBeforeRowRemoved = function (params) {
if (oldOnBeforeRowRemoved) {
oldOnBeforeRowRemoved(params);
}
rowCache[params.rowIndex] = params.row;
params.row.detach();
params.row.find('[virtual-scroller-index]').each(function (index, column) {
column = $(column);
var columnIndex = parseInt(column.attr('virtual-scroller-index'));
columnCache[params.rowIndex] = columnCache[params.rowIndex] || {};
columnCache[params.rowIndex][columnIndex] = column;
});
return false;
};
var oldRenderRow = scrollerConfig.renderRow;
scrollerConfig.renderRow = function (params) {
if (rowCache[params.rowIndex]) {
console.log('got it from cache');
return rowCache[params.rowIndex];
}
return oldRenderRow(params);
};
if (scrollerConfig.renderColumn) {
var oldOnBeforeColumnRemoved = scrollerConfig.onBeforeColumnRemoved;
scrollerConfig.onBeforeColumnRemoved = function (params) {
if (oldOnBeforeRowRemoved) {
oldOnBeforeRowRemoved(params);
}
columnCache[params.rowIndex] = columnCache[params.rowIndex] || {};
columnCache[params.rowIndex][params.columnIndex] = params.column;
params.column.detach();
return false;
};
var oldRenderColumn = scrollerConfig.renderColumn;
scrollerConfig.renderColumn = function (params) {
if (columnCache[params.rowIndex][params.columnIndex]) {
console.log('got it from cache');
return columnCache[params.rowIndex][params.columnIndex];
}
return oldRenderColumn(params);
};
}
return scrollerConfig;
};
return VirtualScroller;
}(jQuery, _));

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc