1.0.0 • Published 7 years ago

@skumtron/poll v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Poll

When all you need to do is poll a HTTP resource. A tiny, TINY polling library.

Installation

Embed lib/poll.js to your project or add it through CDN:

<script src="https://unpkg.com/@skumtron/poll/lib/poll.js"></script>

Alternatively install it through npm:

npm install @skumtron/poll

Usage

Takes an object with following properties as it's argument

var postsPoll = poll({
    url: "https://api.example.com/posts/",
    onResponse: function(res) {
        // handle response
    },
    onError: function(err) {
        // handle errors
    },
    interval: 5000, // Optional, defaults to 10000
    autoStart: false // Optional, defaults to true
});

Returns an object with following (self explanatory) methods

postsPoll.start();
postsPoll.stop();

License

This project is licensed under the MIT License - see the LICENSE file for details

1.0.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago