# pullload

> 上拉加载更多

Latest version **1.0.9** (published 2017-10-09) · 0 weekly downloads

## Install

```sh
npm install pullload
pnpm add pullload
yarn add pullload
bun add pullload
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2017-10-09 |
| First published | 2017-03-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | braisedcakes |
| Keywords | pull |

## Links

- npm: https://www.npmjs.com/package/pullload
- Repository: https://github.com/BraisedCakes666/pullload
- Homepage: https://github.com/BraisedCakes666/pullload#readme
- Issues: https://github.com/BraisedCakes666/pullload/issues
- npm.io page: https://npm.io/package/pullload

## Recent versions

- 1.0.9 (latest) — 2017-10-09
- 1.0.8 — 2017-09-07
- 1.0.7 — 2017-09-07
- 1.0.6 — 2017-08-21
- 1.0.4 — 2017-08-14
- 1.0.3 — 2017-08-10
- 1.0.2 — 2017-06-06
- 1.0.1 — 2017-03-30
- 1.0.0 — 2017-03-27

## README

# pullload

上拉加载更多

组件只判断是否加载更多， 业务逻辑由使用者编写

如果body高度小于可视区高度时，会重复调用pullload，使用者不需要关心回调数据过少的情况

## demo

[点击demo查看](https://braisedcakes666.github.io/pullload/index.html)

![demo地址](./qrcode.png)

## Install

```
npm install pullload --save-dev
```

## Usage

```javascript
//支持amd，cmd，umd等方式调用

import { pullload } from 'pullload'
const { pullload } = require('pullload')

new pullload({

    //onScrollEnd 为 加载更多时的回调
    onScrollEnd : function(pullload){
    }
})
```

## Options

Name     | Default | Description
:------- | :------ | -------------------------
distance | 30      | 加载下一屏的判定条件（距离页面底部距离）,单位px

## Methods

Method | Description
:----- | :----------
stop   | 停止
start  | 启动
tick   | 业务逻辑执行完毕

## Example

```javascript
var page = 1;
new pullload({
    onScrollEnd : function(pullload){
        $.ajax({
            url: 'http://cmnt.sina.cn/aj/v2/index?page=' + page++,
            success: function(rs) {
                if(rs.data.length == 0){
                    pullload.stop();
                }
                var str = '';
                rs.data.forEach(function(item, index) {
                    str += '<div></div>';
                })
                $('body').append(str);
                //当dom操作执行完毕后， 需要运行该方法， 以允许下一次判断
                pullload.tick();
            }
        })
    }
})
```

---
_Source: https://npm.io/package/pullload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
