Skip to content

A simple input preloader to preload inputs on the web.

License

Notifications You must be signed in to change notification settings

pakej/input-preloader-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InputPreloader for JavaScript

npm

A simple input preloader to preload inputs on the web.

Installation

Yarn

$ yarn add input-preloader-js

NPM

$ npm install input-preloader-js

Usage

  1. Assuming you have the following form inputs and id attributes

    <input type="radio" name="a-radio" id="a-radio"> Text for radio
    <input type="float" name="a-float" id="a-float">
    <input type="integer" name="a-integer" id="a-integer">
    <input type="string" name="a-string" id="a-string">
  2. Require the InputPreloader

    var InputPreloader = require("input-preloader-js");
  3. Initialize the InputPreloader with your inputs and their input types

    var inputs = [
        "a-radio:radio",
        "a-float:float",
        "a-integer:integer",
        "a-string:string"
    ];
    var preloader = new InputPreloader(inputs);
  4. Configure the InputPreloader to preload inputs on page load, and save inputs before moving away from the page.

    preloader.configure();
  5. That's it! Now the inputs will be preloaded everytime the page is loaded by the user.

  6. 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.

    preloader.deconfigure();

Contributing

We'd love to accept your patches and contributions to this project! Checkout contributing and code of conduct to learn more.

License

Refer to the license file.