# oncejs

> Simple module that allows calling a function once until it's done

Latest version **1.0.2** (published 2017-01-09) · MIT license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2017-01-09 |
| First published | 2017-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Isaac Ferreira |
| Maintainers | zaclummys |

## Links

- npm: https://www.npmjs.com/package/oncejs
- Repository: https://github.com/zaclummys/once
- Homepage: https://github.com/zaclummys/once#readme
- Issues: https://github.com/zaclummys/once/issues
- npm.io page: https://npm.io/package/oncejs

## Recent versions

- 1.0.2 (latest) — 2017-01-09
- 1.0.0 — 2017-01-07

## README

# once [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

[npm-image]: https://img.shields.io/npm/v/oncejs.svg
[npm-url]: https://npmjs.org/package/oncejs
[downloads-image]: https://img.shields.io/npm/dm/oncejs.svg
[downloads-url]: https://npmjs.org/package/oncejs


Simple module that allows calling a function once until it's done
## npm
```
npm install oncejs
```
## bower
```
bower install once
```

## usage
Using **axios** (third-party) as http library.
```js
//...
var once = require('once'), axios = require('axios');

var sendRequest = once(function (done) {
    axios('www.site.com/api/users').then(resolveResponse).catch(resolveError).then(done);
});

document.getElementById('button').addEventListener('click', sendRequest);
```
Multiple clicks on **#button** won't result in new http requests unless the started request has been resolved.

## license

MIT. Copyright (c) 2017 Isaac Ferreira (zaclummys)

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