Socket
Socket
Sign inDemoInstall

view-list

Package Overview
Dependencies
32
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 2.0.0

23

example.js

@@ -8,2 +8,3 @@ var ViewList = require('./index.js')

var viewlist = new ViewList({
appendTo: document.body,
className: 'view-list',

@@ -19,3 +20,3 @@ eachrow: function (row) {

// On load scroll to the bottom
viewlist.on('load', function (node) {
viewlist.addEventListener('load', function (node) {
node.scrollTop = node.scrollHeight

@@ -36,4 +37,13 @@ })

// Add some initial data to viewlist
var all = []
for (var i = 0; i < 200000; i++) {
all.push({
name: 'user ',
message: 'This is my message #' + i
})
}
render(all)
// Our data model can be a stream
var all = []
var model = through.obj(function (chunk, enc, cb) {

@@ -49,11 +59,2 @@ chunk.name += parseInt(Math.random() * 9, 10)

// Add some initial data to viewlist
var amt = 2000
for (var i = 0; i < amt; i++) {
model.write({
name: 'user ',
message: 'This is my message #' + i
})
}
// Every 1s push a write a new record

@@ -60,0 +61,0 @@ setInterval(function () {

@@ -10,6 +10,6 @@ var BaseElement = require('base-element')

params = params || {}
BaseElement.call(self, params.appendTo || document.body)
BaseElement.call(self, params.appendTo)
// Calculate height outside of the style.height
this.on('load', function (node) {
this.addEventListener('load', function (node) {
self.height = node.offsetHeight

@@ -16,0 +16,0 @@ })

{
"name": "view-list",
"version": "1.4.0",
"version": "2.0.0",
"description": "An infinite scrolling list view element built on a virtual DOM.",
"main": "index.js",
"scripts": {
"start": "budo example.js --live",
"start": "budo example.js:bundle.js --live",
"gh": "browserify example.js -o bundle.js",

@@ -19,3 +19,3 @@ "test": "standard --format"

"attach-css": "^1.0.0",
"base-element": "^2.2.0",
"base-element": "^3.0.1",
"inherits": "^2.0.1",

@@ -22,0 +22,0 @@ "xtend": "^4.0.0"

@@ -26,3 +26,3 @@ # view-list

// Listen for scroll events coming up
viewlist.on('scroll', function (element) {
viewlist.addEventListener('scroll', function (element) {
console.log('List was scrolled to ' + element.scrollTop)

@@ -65,3 +65,3 @@ })

Listen for events with `list.on(name, function () {})`.
Listen for events with `list.addEventListener(name, function () {})`.

@@ -68,0 +68,0 @@ * `load`: Called when element has loaded.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc