Skip to content

jQuery Plugin - betterTrigger - an improved trigger function to fire custom events which are also accessible outside of jQuery

Notifications You must be signed in to change notification settings

sandeep45/betterTrigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery - BetterTrigger

betterTrigger function can be used to send custom events. These events can be listened by jquery via on, bind etc. These events can also be listened by another version of jQuery. These events can also be listened by pure javascript via addEventListener

Example

  $(function(){

    $(document).on("bla", function(){
      alert("in fk$'s handler for event: bla");
    });
    window.document.addEventListener("bla", function(){
      alert("in native js handler for event: bla");
    });

    // firing event `bla` via betterTrigger
    $(document).betterTrigger("bla");


    $(document).on("xyz", function(){
      alert("in fk$'s handler for event: bla");
    });
    // This handler below never runs
    window.document.addEventListener("xyz", function(){
      alert("in native js handler for event: bla");
    });

    // firing event `xyz` via Trigger
    $(document).trigger("xyz");
  });

jQuery Bug Addressed

MDN Documentation

About

jQuery Plugin - betterTrigger - an improved trigger function to fire custom events which are also accessible outside of jQuery

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published