This package has been deprecated

Author message:

this package is never useful

delay-keyup

0.1.3 • Public • Published

Delay Keyup

Sets an event handler when a keyup event fires after a specified timeout.

Install

npm install delay-keyup

Example

<input type="text" name="test"/>
 
<script src="jquery.js"></script>
<script src="delay-keyup.js"></script>
<sciprt>
    //There are several ways to use this plugin:
    //First, HTMLElement
    document.querySelector("input").delayKeyup(function(){
        this.value = this.value.toUpperCase();
    });
 
    //Second, NodeList
    document.querySelectorAll("input").delayKeyup(function(){
        this.value = this.value.toUpperCase();
    });
 
    //Third, jQuery
    $("input").daleyKeyup(function(){
        $(this).val( $(this).val().toUpperCase() );
    });
 
    //Or, just call the function
    delayKeyup("input", function(){
        this.value = this.value.toUpperCase();
    });
</sciprt>

Import in WebPack

import delayKeyup from "delay-keyup";
//Or
import "delay-keyup"; //Recommanded

Or in AMD

define(["delay-timeout"], function(){
    //Do stuffs here...
});

Sets a specified timeout

Default, the event handler will be triggered after 1500 milliseconds, but you can pass the second or third argument to this function a number to specified a custom timeout.

import "delay-keyup";
 
//The second argument
document.querySelector("input").delayKeyup(function(){
    this.value = this.value.toUpperCase();
}, 3000);
 
//The third argument
delayKeyup("input", function(){
    this.value = this.value.toUpperCase();
}, 3000);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i delay-keyup

      Weekly Downloads

      2

      Version

      0.1.3

      License

      MIT

      Last publish

      Collaborators

      • ayonli