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

vue-scroll

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-scroll - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

lib/vue-scroll.browser.js

43

lib/vue-scroll.js

@@ -1,12 +0,6 @@

;(function(undefined){
var Vue = require('vue');
var Vue;
if(window && window.Vue){
Vue = window.Vue;
}else if(!require){
Vue = require('Vue');
}
//Common part start
if(!Vue) {

@@ -25,6 +19,6 @@ throw new Error('Please load vue.js before install current plugin');

vm = this.vm,
callBack = vm[self.expression];
listener = vm[self.expression];
if(el.addEventListener){
el.addEventListener('scroll',function(e){
callBack && callBack(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
listener && listener(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
});

@@ -34,3 +28,3 @@ }else{

var e = window.event;
callBack && callBack(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
listener && listener(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
});

@@ -40,3 +34,3 @@ }

},
update: function (newValue, oldValue) {
update: function (newListener, oldListener) {
//replace old listener by new listener

@@ -46,11 +40,11 @@ var self = this,

if(el.addEventListener){
el.removeEventListener('scroll',oldValue);
el.removeEventListener('scroll',oldListener);
el.addEventListener('scroll',function(e){
newValue && newValue(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
newListener && newListener(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
});
}else {
el.detachEvent('onscroll',oldValue);
el.detachEvent('onscroll',oldListener);
el.attach('onscroll',function(){
var e = window.event;
newValue && newValue(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
newListener && newListener(e, { scrollTop: el.scrollTop, scrollLeft: el.scrollLeft});
});

@@ -63,7 +57,7 @@ }

vm = this.vm,
callBack = vm[self.expression];
listener = vm[self.expression];
if(el.removeEventListener){
el.removeEventListener('scroll',callBack);
el.removeEventListener('scroll',listener);
}else{
el.detachEvent('onscroll',callBack);
el.detachEvent('onscroll',listener);
}

@@ -75,9 +69,8 @@ }

if(window){
Vue.use(vScroll);
}else{
module.exports = vScroll;
}
Vue.use(vScroll);
//Common part end
module.exports = vScroll;
})(undefined)
{
"name": "vue-scroll",
"version": "1.0.2",
"version": "1.0.3",
"description": "scroll directive for vuejs",

@@ -21,3 +21,6 @@ "main": "index.js",

"author": "wangpin",
"license": "MIT"
"license": "MIT",
"dependencies": {
"vue": "^1.0.24"
}
}

@@ -6,23 +6,21 @@ # vue-scroll

# Installation
## NPM(recommended)
## Installation
### NPM(recommended)
```
npm install vue-scroll --save-dev
npm install vue-scroll --save
```
You need to load it manually.
And it is necessary to import it explicitly
```
const Vue = require('vue')
const vScroll = require('vue-scroll')
Vue.use(vScroll)
require('vue-scroll')
```
## Standlone
### Standlone
Simple download and include it in script tag. And it will be auto loaded into vue.
Simple download and include it in script tag.
* [dev-version](http://cdn.rawgit.com/wangpin34/vue-scroll/master/lib/vue-scroll.js)
* [product-version(compressed)](http://cdn.rawgit.com/wangpin34/vue-scroll/master/dist/vue-scroll.min.js)
* [dev-version](http://rawgit.com/wangpin34/vue-scroll/master/lib/vue-scroll.browser.js)
* [product-version(compressed)](http://rawgit.com/wangpin34/vue-scroll/master/dist/vue-scroll.min.js)
# Usage
## Usage
It's very simple, just declar in html tags and provide a defined callback - the scroll function below.

@@ -57,6 +55,8 @@

# Plain sample
* [Hello World](http://cdn.rawgit.com/wangpin34/vue-scroll/master/sample/index.html)
## Example
# LICENSE
* [Hello World](http://rawgit.com/wangpin34/vue-scroll/master/sample/index.html)
## LICENSE
MIT

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