An open API service indexing awesome lists of open source software.

https://github.com/pakej/input-preloader-js

A simple input preloader to preload inputs on the web.
https://github.com/pakej/input-preloader-js

form javascript page pre-loader reload

Last synced: 25 days ago
JSON representation

A simple input preloader to preload inputs on the web.

Awesome Lists containing this project

README

          

# InputPreloader for JavaScript
![npm](https://img.shields.io/npm/v/input-preloader-js)

A simple input preloader to preload inputs on the web.

## Installation
### Yarn
```bash
$ yarn add input-preloader-js
```

### NPM
```bash
$ npm install input-preloader-js
```

## Usage
1. Assuming you have the following form inputs and id attributes
```html
Text for radio



```

1. Require the InputPreloader
```javascript
var InputPreloader = require("input-preloader-js");
```

1. Initialize the InputPreloader with your inputs and their input types
```javascript
var inputs = [
"a-radio:radio",
"a-float:float",
"a-integer:integer",
"a-string:string"
];
var preloader = new InputPreloader(inputs);
```

1. Configure the InputPreloader to preload inputs on page load, and save inputs before moving away from the page.
```javascript
preloader.configure();
```

1. That's it! Now the inputs will be preloaded everytime the page is loaded by the user.

1. In the case where you are done with the form, and doesn't need to preload the inputs anymore, call `deconfigure()` to remove all stored inputs.
```javascript
preloader.deconfigure();
```

## Contributing
We'd love to accept your patches and contributions to this project! Checkout [contributing](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) to learn more.

## License
Refer to the license file.